git config --global user.name
"Henry Lee"
git config --global user.email
[email protected]
git clone git://github.com/0ishi/puzzles.git
puzzles
cd
puzzles
# change directory into your local repo.
- (edit files)
- status of your local changes (optional), e.g.
git status
- discard your local changes (optional), e.g.
git checkout .
- put changes to cache (also called index), e.g.
git add src/Puzzles.cs
- get rid of changes out of cache (optional), e.g.
git reset src/puzzles.java
- diff —cached before commit, e.g.
git diff --cached
- commit changes from cache, e.g.
git commit -m 'added Puzzles.cs.'
- push to remote git repo, e.g.
git push [email protected]:0ishi/puzzles.git
- pull from remote git repo (optional), e.g.
git pull
- merge conflicting changes (optional), e.g.
git mergetool
alias gst='git status' # status of changes alias gco='git checkout' # revert changes alias gdf='git diff' # changes in the working tree not yet staged for the next commit. alias gdfcached='git diff --cached' # Changes between the staged index and the last commit. alias gdfhead='git diff HEAD' # changes in the working tree since the last commit. alias gad='git add' # into cache alias gci='git commit' # commit alias grs='git reset' # out of cache alias gps='git push' # push alias gpl='git pull' # pull alias github='cd /Users/henry/github' # on mac osx alias puzzles='cd /Users/henry/github/puzzles' # on mac osx
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
to configure p4merge & p4diff, ~/.gitconfig (git config file) needs these lines:
[merge] keepBackup = false; tool = p4merge [mergetool "p4merge"] cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED" keepTemporaries = false trustExitCode = false keepBackup = false [diff] external = p4diff