git init
git --help
git config --help
git config --global -l
git config user.name laiboonh
git config --global merge.tool opendiff
git log
git add README.md
git add -A
git reset HEAD <file>
git rm -f test.log
git commit -m "removed test.log"
git rm --cached test.log
git commit -m "removed test.log"
git checkout -- README.md
git commit -m "commit message"
git reset --soft HEAD^
git reset --soft HEAD~
git reset --soft HEAD~~
git reset --hard HEAD~
git add git.ignore
git commit --amend -m "new message"
git diff
git diff --staged
git remote-v
git remote add <name> <address>
git remote rm <name>
git push -u <name> <branch>
git pull
git branch -r
git remote show origin
git push origin :shopping_cart
git branch -d shopping_cart
git remote prune origin
git push heroku-staging staging
git push heroku-staging staging:master
git branch cat
git checkout cat
git checkout -b cat
Merge branch into master. If nothing has happened in the master branch since. Git will "fast-forward" the HEAD pointer.
git checkout master
git merge cat
If there were changes that happened in master since. Git will do a recursive merge and create a log message that branch have been merged in.
This will allow cat branch to have all the commit in master since, and then have our commit in the cat branch.
git checkout cat git rebase master git checkout master git merge cat
git pull
git push
git pull
Collaborating on a remote branch. If work is going to last several days you will want to push it to Github and start tracking it.
git checkout -b shopping_cart
git push origin shopping_cart
git tag
git checkout v0.0.1
git tag -a v0.0.3 -m "version 0.0.3"
git push --tags
git fetch
- Move all changes which are in master but not in origin/master to a temporary area
- Run all origin/master commits one at a time
- Run all commits in the temporary area one at a time
git rebase
git add index.html
git rebase --continue
git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"