Last Updated: February 25, 2016
·
56.86K
· johnyau

Git push up to a certain commit

Sometimes there are a few commits pending to be pushed but you don't want to push all of them for some reason, e.g. partial deployment, and so you want to push them only up to a certain commit.

Then you can do this:

git push <remote> <commit hash>:<branch>

For example, you have 5 commits A>B>C>D>E pending (for simplicity, ABCDE are commit hashes), and you want to push up to commit "C". The following will then push A, B, and C to origin/master.

git push origin C:master

Reference: http://stackoverflow.com/questions/3230074/git-pushing-specific-commit