I work on a project that has 2 branches, A and B. I typically work on branch A, and merge stuff from branch B. For the merging, I would typically do:
git mer
You can only do this if the merge is a fast-forward. If it's not, then git needs to have the files checked out so it can merge them!
To do it for a fast-forward only:
git fetch
git update-ref -m "merge : Fast forward" refs/heads/
where
is the fetched commit, the one you want to fast-forward to. This is basically like using git branch -f
to move the branch, except it also records it in the reflog as if you actually did the merge.
Please, please, please don't do this for something that's not a fast-forward, or you'll just be resetting your branch to the other commit. (To check, see if git merge-base
gives the branch's SHA1.)