git_cheat_sheet
This is an old revision of the document!
Table of Contents
Git Cheat Sheet
Resources
Try Git
| git init | |
| git config --global core.editor "atom --wait" | Make Atom the default editor. |
| git config --global user.name "Stephen Heise" | |
| git config --global user.email "Stephen@tallguyracing.com" | |
| git status | |
| git add filename.txt | |
| git commit -m “Commit message” | |
| git log | |
| git remote add origin https://whatever.com | |
| git push -u origin master | -u means remember these settings |
| git pull origin master | |
| git diff head | |
| git diff --staged | |
| git reset octofamily/octodog.txt | unstages a file |
| git checkout -- octocat.txt | go back to last checkout / undo |
| git branch | ??? Show branches. ??? |
| git branch clean_up | Create new branch. |
| git checkout clean_up | Switch branches. |
| git checkout -b new_branch | Checkout and create branch at the same time. |
| git rm '*.txt' | Remove local files and include the removal in the staging area. |
| git rm -r folder_of_cats | Recursively remove all folders and files from the given directory. |
| git commit -a | Include the deletion of local files to staging area, do the commit. |
| git merge clean_up | |
| git branch -d <branch name> | Delete a branch |
| git branch -D <branch name> | Force delete a branch. Use if branch not merged. |
| git push | |
| gitk | A commit viewer. |
| git tag -a tagname -m “commit comment” | Annotated tag (preferred over lightweight tags). |
| git tag tagname | Lightweight tag (good for temporary tags). |
Visual Studio Online
git remote add origin https://tallguy789.visualstudio.com/_git/AnotherTestProject git push -u origin --all
Import from SVN
git svn clone https://ares/svn/SVNRepository/Presentations --tags=Tags --trunk=Trunk --branches=Branches --authors-file=..\users.txt
Use WinMerge
Do this in the .gitconfig file.
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
trustExitCode = true
cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e -dl \"Local\" -dr \"Remote\" $LOCAL $REMOTE $MERGED
[diff]
tool = winmerge
[difftool "winmerge"]
name = WinMerge
trustExitCode = true
cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE''
git_cheat_sheet.1486801945.txt.gz · Last modified: 2017/02/11 21:32 (external edit)
