My dotfiles already has beautiful Git configuration, powerful aliases and optimal global gitignore. You may put your custom settings into ~/.gitlocal
.
You can tell it who you are using these commands:
git config -f ~/.gitlocal user.email "[email protected]"
git config -f ~/.gitlocal user.name "Name Lastname"
Default configuration in .gitconfig
:
- UI color is
auto
. - Diff colors it is:
white bold
for meta information;cyan bold
for frag;red bold
for old lines;green bold
for new lines.
- Default editor is Vim instaed of Vi.
push.default
set ascurrent
.- Automatic replacement
git://github.com/
,gh:
,github:
addresses as[email protected]:
for GitHub. - Automatic replacement
git://gist.github.com/
,gst:
,gist:
addresses as[email protected]:
for Gists. - User custom settings gets from a
~/.gitlocal
file.
git a
→git add
— Patch mode for specified files.git ua
→git reset HEAD
— Unstage files.git ap
→git add -p
— Add file contents to the index.git b
→git branch
— List, create, or delete branches.git c
→git commit
— Record changes to the repository.git co
→git checkout
— Checkout a branch or paths to the working tree.git ca
→git commit -a
— Commit with automatically stage files that have been modified and deleted.git cm
→git commit -m
— Commit with commit message.git cam
→git commit -am
— Add all files and commit with message.undo
→reset --mixed HEAD^
— Reset index changes, but not the working tree.git s
→git status -sb
— Short status with current branch. Status codes can be interpreted as follows:M
= modifiedA
= addedD
= deletedR
= renamedC
= copiedU
= updated but unmerged??
= untracked paths
git master
— Go to master branch and pull from remote.git l
— Commits log with pretty single line format.git ll
— Log with list of changed files for each commit.git ignore
— Ignore files: append file to .ginignore.git this
— Initialize, add all files and commit.git amend
— Ammend last commit.git redo
— Ammend last commit with its original message.gr
— Jump to root folder of Git repo.git-fork <original-author>
— Add remote upstream.git-upstreamer
— Auto configure a remote for a fork.git-upstream [branch]
— Sync branch with upstream (as defaultmaster
).