Grouping changes …or how to use branches via checkout, branch, merge A develop feature HEAD git branch feature git checkout feature git add & git commit B
Grouping changes …or how to use branches via checkout, branch, merge A develop feature HEAD git branch feature git checkout feature git add & git commit git add & git commit B C
Grouping changes …or how to use branches via checkout, branch, merge A develop feature HEAD git branch feature git checkout feature git add & git commit git add & git commit … B C D E
Grouping changes …or how to use branches via checkout, branch, merge A develop feature HEAD git branch feature git checkout feature git add & git commit git add & git commit … git checkout develop B C D E
Grouping changes …or how to use branches via checkout, branch, merge A develop feature HEAD git branch feature git checkout feature git add & git commit git add & git commit … git checkout develop git merge feature B C D E F
branches It’s ok to have different branch schemes, depends on client, project, technology… a common workflow > no workflow at all keep it simple or people won’t follow the scheme
.gitignore know and use .gitignore committed files cannot be ignored (well, not easily) https://github.com/github/gitignore take a look at git config and .gitattributes as well
git pull git pull is considered harmful git fetch origin git rebase origin/develop git config --global pull.ff only when changes can’t be applied fast-forward:
pull request why? we all make errors find logic bugs high quality code enforce readable code style enforce good commit history let people know what you are working on (even discuss future features) learn (both ways) fun
pull request useful messages: “Can we make this more readable?” “What would be a better name for this method?” “This needs to be refactored into smaller methods” “Why did you choose this approach?” “”
How do I… …find the commit that broke my project? git bisect start git bisect bad git bisect good # Bisecting: N revisions left to test after this (roughly log2(N) steps) git bisect run
How do I… …save current changes for later use without committing because you need to do something else? git stash git stash list git stash pop git stash apply