Skip to content

Instantly share code, notes, and snippets.

/thoughts.md Secret

Created April 14, 2017 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4e698b0d68ff96c2b0fc840b19ae3c3a to your computer and use it in GitHub Desktop.
Save anonymous/4e698b0d68ff96c2b0fc840b19ae3c3a to your computer and use it in GitHub Desktop.

Assume: C0<-C1<-C2<-C3<-C4 (on old branch)
💭 C2 thru C4 are stupid commits

git reset --hard C1
git commit -am "good commit (D2)"

💭 Crap, how am I gonna push this?

git branch new
git push origin new

💭 Needs another change

git commit -am "another good commit (D3)"

💭 Wait... what branch am I on? Crap I forgot to checkout, well it seems like this is commiting to the remote new when I specify it that way so guess I'll do that again and then straighten it out

git push origin new

💭 What does the new branch look like?
C0<-C1<-D2
💭 Okay, so the remote new branch probably has the correct commits, let's get old back to normal.

git checkout old
git pull origin old

💭 What do the branches look like?
old: C0<-C1<-C2<-C3<-C4<-D2<-D3
new: C0<-C1<-D2

💭 ugh! I was hoping for
old: C0<-C1<-C2<-C3<-C4
new: C0<-C1<-D2<-D3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment