How can I fast-forward a single git commit, programmatically?

Posted by Norman Ramsey on Stack Overflow See other posts from Stack Overflow or by Norman Ramsey
Published on 2010-05-23T04:18:00Z Indexed on 2010/05/23 4:20 UTC
Read the original article Hit count: 371

Filed under:
|
|

I periodically get message from git that look like this:

Your branch is behind the tracked remote branch 'local-master/master' 
by 3 commits, and can be fast-forwarded.

I would like to be able to write commands in a shell script that can do the following:

  1. How can I tell if my current branch can be fast-forwarded from the remote branch it is tracking?

  2. How can I tell how many commits "behind" my branch is?

  3. How can I fast-forward by just one commit, so that for example, my local branch would go from "behind by 3 commits" to "behind by 2 commits"?

(For those who are interested, I am trying to put together a quality git/darcs mirror.)

© Stack Overflow or respective owner

Related posts about git

Related posts about git-pull