Skip to content

Instantly share code, notes, and snippets.

@fatihky
Last active October 19, 2016 05:36
Show Gist options
  • Save fatihky/03c490f648ca7829cbb4 to your computer and use it in GitHub Desktop.
Save fatihky/03c490f648ca7829cbb4 to your computer and use it in GitHub Desktop.
git wokflow merge

git clone blah

git checkout master <--that's normal

git checkout test3

git log <-- i want to check the log to understand how the history in the branch looks

if the branch is out of sync

git rebase master

.. blah blah replaying commits ahead

but maybe i want to squash extra commits

git rebase -i master

-i is the secret of rebase that unlocks squash and fixup

with squash and fixup you can rewrite the commit history of your local repo

you can also rewrite the history of your remote

but you need to force it

after you finish making the authoritative changes

in your local

# some more commands that I remember(@fatihky)
git commit --amend
git commit --amend -s

you do: git push -f

IMPORTANT: git push -f <-- back to the same branch you were working on

(not master)

now

clean and sync things

git rebase master

git checkout master

git merge test3

git push

all done! looks pretty! :)

that is the workflow