Skip to content

Instantly share code, notes, and snippets.

@torgeir
Last active September 19, 2017 16:40
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 torgeir/50e5dca219228c0a1173499b5bb2e29e to your computer and use it in GitHub Desktop.
Save torgeir/50e5dca219228c0a1173499b5bb2e29e to your computer and use it in GitHub Desktop.
GIt-kurs for nyansatte: Demo

demo

[alias] i ~/.gitconfig

https://github.com/torgeir/dotfiles/blob/master/gitconfig#L5-L14

“flytte” commit med cherry-pick & reset

git cherry-pick <sha>
git checkout -
git reset --hard HEAD^
git checkout -

patch

add, reset, checkout, men på små “hunks”

git add -p
git reset -p
git checkout -p

rebase

interactive rebase

fixup

reword

squash

“vanlig” rebase

endre base/utgangspunkt for en branch

legge til mer kode i en tidligere commit

stash, rebase, edit, stash pop, commit amend, rebase continue

reflog

som reset, men hopper i tid, blandt git operasjoner du har gjort lokalt

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