Take you through an everyday git workflow
Need help at anytime?
http://git-scm.com/book/
man git
git help
man git-<verb> #eg man git-bisect
git config --global user.name "Rusty Taco"
git config --global user.email [email protected]
git clone [email protected]:amasare/git-basics.git
Modify existing file "donkey.txt"
Create 3 new files "playArea1.txt", "playArea2.txt", "playArea3.txt"
Stage files
Modify existing file "donkey.txt" again
Notice staged and unstaged state when you run a git status.
git status
git status -s (--short)
git diff (--staged)
git add .
git commit -m "Short message describing what you did. "
Remove newly created file "playArea1.txt" from git (staging and working directory -becomes untracked)
git rm playArea1.txt
######Commit Messages Guide
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
###Branches
git branch 'awesome_branch'
git log --decorate #observe which commits all the branches are pointing to
HEAD - branch git is on at the moment
git checkout 'awesome_branch'
Create commit on new branch and check commits pointed to again
Switch to master, check commits pointed to. Changes are isolated!
git log --decorate --all
Replay changes in awesome_branch since it diverged from master, record result in a new commit on top of master
git merge master
git blame
git bisect
git log -Sfind_log_this_word_was_introduced
git stash