Suppose I have 5 local commits. I want to push only 2 of them to a centralized repo (using an SVN-style workflow). How do I do this?
This did not work:
<
What I do is work on a local branch called "work". This branch contains all the temporary commits (like workarounds or private build options or whatever) that I don't intend to push to the upstream repository. I work away on that branch, then when I want to commit I switch to the master branch, cherry-pick the appropriate commits that I do want to commit, then push master.
After pulling changes from the upstream into my master branch, I git checkout work and git rebase master. That rewrites all my local changes to be at the end of the history.
I'm actually using git svn with this workflow, so my "push" operation involves git svn dcommit. I also use tig which is a nice text mode gui repository viewer, to cherry-pick the appropriate commits to master.