I have a git repository on a server. I can pull or clone copies from it. In a working copy, I want to create a branch and do some work. So far so standard.

While doing that work, I may well perform several commits and even create some more temporary branches as I try out ideas. That is the git way of things as I understand it.

However, when I am happy with what I have done, I want to merge the new stuff into my master branch and push the result up to the server. What I don't want is all those temporary branches and intermediate commits in my server repository. I would like to see just one (or a small number of key) commit(s) on the server not every footling little thing I tried while doing the change.

I can't work how to do that. Is it possible?

1 Answer 1

  • You can squash and reorder commits in a branch using git rebase -i master, then merge it.

    See also documentation in Git Book, GitHub, git ready.

  • Branches remain local unless you push them somewhere. If you push master, other branches won't get pushed automatically.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.