Skip to content

Latest commit

 

History

History
60 lines (51 loc) · 2.68 KB

GIT.md

File metadata and controls

60 lines (51 loc) · 2.68 KB

Git

My dotfiles already has beautiful Git configuration, powerful aliases and optimal global gitignore. You may put your custom settings into ~/.gitlocal.

Setup

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"

Configuration

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 as current.
  • 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.

Aliases

  • git agit add — Patch mode for specified files.
  • git uagit reset HEAD — Unstage files.
  • git apgit add -p — Add file contents to the index.
  • git bgit branch — List, create, or delete branches.
  • git cgit commit — Record changes to the repository.
  • git cogit checkout — Checkout a branch or paths to the working tree.
  • git cagit commit -a — Commit with automatically stage files that have been modified and deleted.
  • git cmgit commit -m — Commit with commit message.
  • git camgit commit -am — Add all files and commit with message.
  • undoreset --mixed HEAD^ — Reset index changes, but not the working tree.
  • git sgit status -sb — Short status with current branch. Status codes can be interpreted as follows:
    • M = modified
    • A = added
    • D = deleted
    • R = renamed
    • C = copied
    • U = 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 default master).