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 use git checkout -b somebranch origin/somebranch to make sure my local branches track remotes already. I would like a way to pull from the tracked branch no matter which branch I am using. In other
Suppose that branch B is straight ahead of the current branch (so that a fast-forward merge is possible). How do doing git merge B --ff and doing git reset B --hard at this point differ?
When I want to merge to a local branch I do this: git checkout master git pull origin master git checkout my_branch git merge master Is there a way to merge from the master on the repository into my
I am on branch tm-skeleton and executing git pull does something (technically, it asks for password and I hit <ctrl-c> there), but how do I know where is it pulling from? Usually, [branch tm-sk
My setup is: $ git remote show origin * remote origin Fetch URL: ssh://repo.xxx/project.git Push URL: ssh://repo.xxx/project.git HEAD branch: master Remote branches: test tracked test2 tracked Local r
Subtrees in Git work nicely although some git commands remain to be supported for subtrees. Here's the question: How to make the subtree pull from a different remote branch like stable or integra
This question already has an answer here: Merge, update, and pull Git branches without using checkouts 8 answers My remote git repo has two branches 'master' (for the next release) and 'maint'
I am new to using GIT in eclipse i have been playing around with the tool and i did several push and merges to the server however i am seeing in the Remote Tracking option when i do a fetch i am getti
After fetching from remote using git fetch, we need to use something like git merge origin/master I would like to know if this command also does git commit at the same time? Is the order origin/maste
I want to pull from from an upstream branch and I want to ignore all commits made by me in my local and my remote on git. I only want the changes from the upstream remote. I am having issues with: gi
I have a remote branch where I pushed up changes from my local, then realize there was changes to master so i checkin to master run git pull then go back to my local branch and run git rebase master,
Say that I'm on my feature branch XXXX and issuing a git pull bad_remote master here is a BAD thing to do (in the way our workflow and branches are set up, of course). Is there a way to tell git (or v
I would like to use shortcuts or aliases for git commands. git diff git status git push git pull git stash git branch -a How do I create shortcuts or aliases, is there a predefined list?
My problem is related to Fatal Git error when switching branch. I try to fetch a remote branch with the command git checkout -b local-name origin/remote-name but I get this error message: fatal: git
I would like to stop tracking certain branches. I set up tracking using git branch --set-upstream foo origin/foo. How do I undo this?
I have some git repo with alot of remotes, some of remote branches a unique and i have not local tracking branches for it. Today I did mistake on changing a remote url (I used remote1 instead of remot
I am attempting to figure out which remote branch was most recently updated. Something like 'git show-ref' but in chronological order would be good enough. How do I go about doing this?
Hey I am working on a local branch on an Android Project.I want to replace all code on my local branch with all the code on the remote master.When I try to do git pull origin master,it tries to merge
I have a bare repo that was cloned from git.drupal.org. I have cloned from this bare repo to various different websites. From each of these, I push a site-specific branch onto the bare repo. E.g. if
Occasionally, my collaborators will panic when there is an automatic merge generated as the result a git-pull, and just accept the default commit message. Before this commit gets pushed, I want to b
I did: git co upstream/master # To no branch. <then did a trivial edit on some file...> git commit -a -m Trivial edit git push origin NewBranch But got this: $ git push origin ignore-netbeans
Is it possible to reset branch that is not currently checked out? I want to create a cron script that will perform git svn fetch and then update all local branches tracking svn remote branches with ne
I work in develop branch. Sometimes, when I want to push changes to origin, git say, that there are some changes in origin/master branch. How to pull changes from remote master to local master without
I am totally new to git and in an emergency to use git commands to rebase my local branch to remote master. Things happened like this. 1.I forked a repo Logan676/seadroid from haiwen/seadroid on Githu
I'm working on a remote branch named sidebar, created like this (from my pc, not remote repo) : $ git branch sidebar $ git checkout sidebar $ git push -u origin sidebar $ git pull origin sidebar Afte
I'm in master and I do a git pull, I get a message indicating I need to pull a remote branch. Typically I do a git co [branch] then git pull/rebase. Is there a way to git pull/rebase of [branch] witho
This question already has an answer here: What are the differences between 'git pull' and 'git fetch'? 19 answers So - can someone clarify this one: I run: git pull origin master git status A
I have a test branch test that was created several days ago. There was a change made to a file file.py in master since then. I need to merge only this change (and nothing else) from master to test. Wh
Aim : To delete a remote branch named 'branchname' Steps I used to do was: [first approach] git branch -d branchname git push origin :branchname Today I tried to delete using the same above steps, b
how do I fetch a remote branch and update git's local ref for that branch without effecting the current branch? For example if I do this $ git pull origin master origin/master is merged into my curre
I have a local git repository which tracks a remote SVN repository via git svn. I have made and committed some changes in the local git repository, but now I'd like to create a branch that reflects SV
I am working with a remote git repo that does NOT support email notification upon commit. I am wondering if anyone know any means/tools to monitor and track the commit on one or more branches? Thanks
If someone deleted a remote branch because the work is over and I don't know, I won't do a git fetch --prune and eventually I will push back the deleted branch. Is there a viable solution for forcing
Usually when I do git pull or git status it automatically fetches and merge the data from the remote branch, and show the local commits that can be pushed on that branch. A new branch have been create
This question already has an answer here: Undo a Git merge? 16 answers This question is different from other questions in that, I want to keep some commits while I revert some commits. Here 's
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
How do I pull all of the remote branches to my own repository? if I type: git branch -a I get a long list of branches, but if I type: git branch I see only 2 of them. How do I pull ALL branches into
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
Possible Duplicates: How do I push amended commit to the remote git repo? Undoing a git push Hi, I've deleted some commits from my master branch by using git reset --hard SHA_VALUE I have, however
Say I have a feature branch, into which I merge upstream changes prior to pushing my changes back: git branch feature1 ... [edit my code] ... [commit] git fetch origin master git merge fetch_head [or
We were using a build script to automate our publishing process and it was working with SVN but now we are using Git and need to do some command line operations to pull from our remote repository. I w
When I try to create a new branch tracking a remote branch, I get this: che@nok ~/prj/git-ipc $ git branch -t test main/some_remote_branch error: Not tracking: ambiguous information for ref refs/remot
I have a git repository which tracks an svn repository. I cloned it using --stdlayout. I created a new local branch via git checkout -b foobar Now I want this branch to end up in …/branches/foobar in
How can I tell git to ignore my local file and take the one from my remote branch without trying to merge and causing conflicts?
When I try to push to a remote git branch to delete it with git push origin :branchname I get the following error message: error: unable to push to unqualified destination: remotes/origin/branchname
let's say I have the following config file [branch master] remote = origin merge = refs/heads/master [remote origin] url = ssh://origin.com fetch = +refs/heads/*:refs/remotes/origin/* [remote far
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
Using the github webhooks, I would like to be able to pull any changes to a remote development server. At the moment, when in the appropriate directory, git pull gets any changes that need to be made.
A word of warning: I'm a n00b to git in general. My team uses feature branches in svn, and I'd like to use git-svn to track my work on a particular feature branch. I've been (roughly) following Andy D
I try to merge branch into master: repo = pygit2.Repository(/path/to/repo/) branch = repo.lookup_branch(upstream/branch, pygit2.GIT_BRANCH_REMOTE) oid = branch.target merge_result = repo.merge(oid