Skip to content

Instantly share code, notes, and snippets.

@adeak
Created October 28, 2020 20:35
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 adeak/53879d58c084b85e4bb1c5bcfdb8a5f9 to your computer and use it in GitHub Desktop.
Save adeak/53879d58c084b85e4bb1c5bcfdb8a5f9 to your computer and use it in GitHub Desktop.
git fast-forward example
# create repo
git init
# set up branch stuck_on_foo with a single commit
touch foo
git add foo
git commit -m 'foo'
git branch stuck_on_foo
# add another commit to master
touch bar
git add bar
git commit -m 'bar'
# go back to stuck_on_foo and merge master into it to witness a fast-forward
git checkout stuck_on_foo
#gittree is an alias I have for this from https://stackoverflow.com/a/35075021:
git log --all --oneline --graph --decorate --branches
git merge master # the fast-forward
git log --all --oneline --graph --decorate --branches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment