Hulk Hulk - 5 months ago 14
Git Question

Git Push: How many local commits this command pushes to mainline or origin

I have two commits on my mainline branch which is the actual project master branch. I want these two commits to go as separate commits onto mainline i.e., I don't want to apply git rebase -i HEAD~2 and squash the commits to one commit and push that one commit. The reason is these are two separate logical implementations and should be gone as two separate commits.
My doubt here is does giving git push command once, push these two commits in the order they are onto mainline?


I hope I'm understanding the question correctly. Yes, if you have two separate commits in your local repository, they will stay two separate commits if you do a git push. Pushing to a remote repository keeps the individual commits intact -- it will not merge them together or switch their order.