cheat-fork-echo/cheatsheets/git
Chris Lane c03cca9298 Merge branch 'master' of github.com:chrisallenlane/cheat
* 'master' of github.com:chrisallenlane/cheat: (24 commits)
  [APT-GET] Change <cat | grep> to grep [PACMAN] Change the AUR instructions
  Make cheat working with python3 :)
  [DD] Watch the progress of `dd` with `pv` and `zenity`
  [APT−GET] Show apt-get installed packages
  [DD] Add some tricks for dd
  [APT-GET] Donwload deb withtou installing it
  [NMAP] Speed up nmap scan
  [NMAP] Correct a bug
  [FIND] add a cheat to find all files that have the same node (hard link) as MY_FILE
  [NMAP] Update nmap
  [IPTABLES] Add some cheats for iptables
  [SSH] add a cheat for ssh (encryption)
  [IPTABLES,TCPDUMP] Add cheats for iptables and tcpdump
  [XARGS] Add xargs example
  - Cheatsheets added for a couple of my favourite commands:    - rsync: file copy and backup multi-tool    - indent: one liner to nicely format C/C++ source.
  [PS,GREP] Exclude grep from your grepped output of ps.
  Update wget
  Update wget
  Adding two invaluable commands to tmux cheatsheet
  include commands to mirror locally
  ...
2014-04-24 18:09:10 -04:00

53 lines
1.9 KiB
Text

# To set your identify:
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
# To set your editor:
git config --global core.editor emacs
# To enable color:
git config --global color.ui true
# To stage all changes for commit:
git add --all
# To commit staged changes
git commit -m "Your commit message"
# To edit previous commit message
git commit --amend
# To removed staged and working directory changes
git reset --hard
# To remove untracked files
git clean -f -d
# To remove untracked and ignored files
git clean -f -d -x
# To push to the tracked master branch:
git push origin master
# To push to a specified repository:
git push git@github.com:username/project.git
# To delete the branch "branch_name"
git branch -D branch_name
# To see who commited which line in a file
git blame filename
# To sync a fork with the master repo:
git remote add upstream git@github.com:name/repo.git # Set a new repo
git remote -v # Confirm new remote repo
git fetch upstream # Get branches
git branch -va # List local - remote branches
git checkout master # Checkout local master branch
git checkout -b new_branch # Create and checkout a new branch
git merge upstream/master # Merge remote into local repo
git show 83fb499 # Show what a commit did.
git show 83fb499:path/fo/file.ext # Shows the file as it appeared at 83fb499.
git diff branch_1 branch_2 # Check difference between branches
git log # Show all the commits
git status # Show the changes from last commit