←back to thread

Oh Shit, Git?

(ohshitgit.com)
464 points Anon84 | 1 comments | | HN request time: 0.212s | source
Show context
javier_e06 ◴[] No.42730659[source]
Lately I've been asked to avoid merge-commits. They pollute the logs? If my push is blocked I am too far behind I create a new temp branch of master and do a "merge --squash" to it and then a "reset --hard" from temp branch back to my original branch. Heck sometimes I rather keep my changes in patches to void does darn merge CONFLICTS...specially when rebasing.
replies(4): >>42730740 #>>42730864 #>>42731305 #>>42732035 #
1. a_t48 ◴[] No.42730740[source]
From memory...

    git merge origin/master
    git reset origin/master
    git commit -am "squash" # might need some extra fixup if your branch has added files
No need to make a temp branch. I know there's probably a more efficient way of doing this, but this is what's stuck in my head.