How Do I 'git fetch' and 'git merge' from a Remote Tracking Branch (like 'git pull')
I have set up some remote tracking branches in git, but I never seem to be able to merge them into the local branch once I have updated them with 'git fetch'.
For example, suppose I have remote branch called 'an-other-branch'. I set that up locally as a tracking branch using
git branch --track an-other-branch origin/an-other-branch
So far, so good. But if that branch gets updated (usually by me moving machine and commiting from that machine), and I want to update it on the original machine, I'm running into trouble with fetch/merge:
git fetch origin an-other-branch
git merge origin/an-other-branch
Whenever I do this, I get an 'Already up-to-date' message and nothing merges.
git pull origin an-other-branch
always updates it like you would expect.
Also, running git diff
git diff origin/an-other-branch
shows that there are differences, so I think I have my syntax wrong.
What am I doing wrong?
EDIT [2010-04-09]: I have checked a couple of times, and I'm definitely not on a different branch. Should my 'git fetch' followed by a 'git merge' (as shown above) do the exact same thing as a git pull? I will get some workflow showing the results of a git status etc.
I have a develop branch and a feature branch in my git repo. I added a commit to develop and now I want that commit to be merged to my feature branch. If I do this git checkout feature git merge devel
I want to override a specific branch that im currently in, in order to override/replace everything from the remote repository server. If i do git pull on that branch i always get a merge conflict beca
$ git remote -v (null) firstname.lastname@example.org:username/Savvy.git (fetch) (null) email@example.com:username/Savvy.git (push) origin firstname.lastname@example.org:username/SavvyCode.git (fetch) origin email@example.com:username/Sav
I do not want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. Instead, I want to use simplest way to rename local branch, which is not pushe
I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch? I know I can just edit the .git/config file, but it seems there should be an ea
There is a branch on remote I would like to work on. It is old and I no longer have an old copy of it on my local machine. It is really far behind master. Whenever I attempt to pull it I get conflicts
I have 2 local git archives in /a and in /b which were cloned from remotes/origin. There is a new branch z on /b How can I track and fetch branch z from archive /a ? I tried this: cd /a git remote add
This is not a duplicate of git pull from clean directory has merge conflicts - In that question the user was trying to pull from a remote which had commits which were not in the local branch. In my ca
So I have a clone of a git repo. When I did git pull origin it tells me: You asked to pull from the remote 'origin', but did not specify a branch. Because this is not the default configured remote for
What I'm interested in is seeing which branch master is configured to push to and pull from? I'm using git version 1.9.3 Currently the only solution I have found is git remote show [remote]. Which if
I sometime fork SVN repos in GIT. When the SVN repo is updated I would like to be able to easily merge SVN changes doing a git merge. The ideal would be to be able to have the SVN repo trunk in a GIT
I wrote a post-receive hook to pull from central when somebody else is pushing. My problem is that I see: remote: git: 'pull' is not a git command. See 'git --help'. However, when I pull manually, ev
I'm cloning a repo that was first generated by git-p4. git-p4 uses a 'remotes/p4/master' branch that I would like to track. How do I tell git, which is cloning that repo, to track remotes/p4/master as
Let's say I have a private topic branch called develop with 2 commits ahead of master. What does git pull origin master do? Pull everything from the remote master in the local develop and merge it? Pu
I have a bunch of remote (tracking) branches that I have created local branches from (so I can write, commit and push) eg. origin/myfeature. Now I would like to merge origin/myfeature into master. I c
I have a remote branch 1.4 I did a git fetch origin with the result: 13b1449..51618fe 1.4 -> origin/1.4 I then did a git rebase 13b1449 git responded Current branch 1.4 is up to date I then did a g
How could I merge several, selected commits from branch B into A. I did this but I am not sure if there is a one line solution for this: git log -p -1 B~~ | git apply git log -p -1 B~ | git apply git
I'm trying to update my webbynode pulling from github but I got the message below: You asked to pull from the remote 'firstname.lastname@example.org:sigbackup/gsapp.git', but did not specify a branch. Because this i
The command I want to run is git pull origin_au a_really_long_branch_name_that_i_dont_want_to_type Is there anyway I can abbreviate the branch name?
A central git repository we use has two branches that diverged a long time ago. Someone accidentally merged the old branch into the newer one, causing some conflicts. Now I have a merge commit sitting
I am looking for a way of detecting up front whether a git pull or git merge would fail. The sort of script I want to perform is to update a server. git fetch git okay stop server backup data git merg
There is a small topic branch (on a contributor's remote repo) that I'd like to apply on top of my master. I think the canonical way to do this is: git merge contributor/topic-branch But I'd like to
Can we create a remote branch in git using jgit without checking out. For example I want to create a branch named foo from branch named bar in my remote repository without checking out branch bar loca
I'm developing an iPhone application with another developer. Our git repository is situated on the remote server. So we are working with our working copies and then we do commit, pull, push one by one
In git, how can I checkout out the HEAD version of my remote/tracking branch? Basically, I want to do a 'svn checkout ' in git. I think the closest thing I find is 'git fetch', but from the man page,
I'm having trouble comparing local master (which is on same commit as origin/master) with production/master. $ git remote -v origin email@example.com:mydomain/mydomain.git (fetch) origin firstname.lastname@example.org:m
What the title says. Version of git is 220.127.116.11 I've tried using git branch --track But it throws errors saying that the branches already exist. I am confused. Thanks in advance!
After I solved all merge conflicts of important files, I want to merge regardless of all left conflict files. Git should just keep the files from the branch I want to merge in (--ours). How can I do t
In my current repo I have the following output: $ git branch -a * master remotes/origin/master remotes/public/master I want to delete 'remotes/public/master' from the branch list: $ git branch -d rem
I'm just wondering what are more reasons to use git pull --rebase instead of git pull except this weird merge commits that appear when you do just git pull? Thanks!
I have forgot to create local branch and was working with remote. After making some changes, i by mistake using Eclipse Git plugin commit this branch in nowhere(obliviously there wasn't local branch).
Is there a way to see what commits have been pulled in from the remote repository after you do a git pull --rebase? In other words: git pull will show a summary of changed files at the end (like git
I'm a git newbie, and this is what I currently have: master: A -- B -- C \ \ branch: X -- Y How do I Update commit Y with changes from B and C? Is this simply: git fetch machine master; git merge ma
I've been wondering if there's an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names. For example: $ git clone myrepo.git $ git ch
How do I merge git users? I made several commits using an incorrect user name and now they are shown in the repo history, I would like to merge them with my real name that I'm going to use for the gi
I generally do the git pull command to fetch+merge with my local repositor from remote repo Does git pull fetches+merges all the branches from github repo or just do the operation specifically for th
My remote Git repository has 3 branches: master develop news When a dev change he will branch off develop such as issue123. When he finished changing, he will push to remote issue123. I will merge
What is the difference between doing: mkdir repo cd repo git init git remote add origin git://github.com/cmcculloh/repo.git git fetch --all git pull origin master and git clone git://github.com/cmccu
I'm looking for a solution to apply a feature branch to the development branch in git without actually moving the branch pointer. Essentially, I'd like to create a single commit off of the feature bra
I'm trying to find the syntax for merging a tagged commit onto another branch. I'm guessing that it's straight forward but my feeble search attempts aren't finding it.
I login to one computer as userA. $ git remote -v origin git:/git/repo/code.git (fetch) origin git:/git/repo/code.git (push) When I do git fetch origin, it asks for password of userA. Is it possibl
I have a remote and a local git repository. Local repository is clone from the remote. When I modify my local repository and commit to the master branch. Then I run git push to remote repository. Bu
I have tried get the change of github repository to one repository bazaar, something like this: bzr merge email@example.com:Author/repository.git is there any way to do this?
If I do git fetch origin master doing git diff ...origin does not have the same results if I do git fetch (without specifying branch) and then do git diff ...origin (see below). Why is that? (just to
I merged a relatively old branch into master and the outcome of the merge was an unholy mess. For some unknown reason when I ran git merge it automatically took some of the out of date code that had s
I wish to use git with multiple remote repos. I have my central git server (aka origin), as well as my local dev machine. What I am trying to do is pull down the latest linux kernel from kernel.org's
I've read about git clean and git reset but I don't think they do what I need. I tried git pull but it didn't fix the issue (git pull results in: Already up-to-date.) My remote repo at github is fine.
The remote repository has two branches: master, develop. Then, I checked my local branch by git branch , I notice I have only master branch, so I run command git fetch origin. After this, when I run
I do: $ git commit . $ git push error: Entry 'file.php' not uptodate. Cannot merge. Then I do $ git pull Already up-to-date. What do I do? I just want to get the latest version from the remote copy,
How can I get list of branches emerging from any branch in git ? Also what is the difference between fetch and pull command in git ?