ABCDEFGHIJKLMNOPQRST
1
TaskCommand / Reference URLNotes
2
Getting started with Githttp://www.youtube.com/watch?v=ZDR433b0HJY
3
4
Further Reading
5
Line endings ^M issueshttp://stackoverflow.com/questions/1889559/git-diff-to-ignore-m
6
7
Installing & Configuring on Ubuntu
8
Install git on an ubuntu systemapt-get install git
9
Specify your name after git is installedgit config --global user.name "Jared De Blander"
10
Specify your email after git is installedgit config --global user.email jared0x90@gmail.com
11
Auto unix line endingsgit config --global core.autocrlf true
12
Enable colored outputgit config --global color.ui true
13
Cache password for some timegit config --global credential.helper cache
14
Location of your git config file~/.gitconfig
15
Shortcut to edit your global .gitconfiggit config --global -e
16
My basic ~/.gitconfighttps://github.com/jwd83/dotfiles
17
18
Working with Git
19
Start a new project in the current foldergit init
20
View your current branch and pending commitsgit status
21
Add the current tree of files to the next commitgit add .Files matching those in .gitignore will not be included in the next commit. See the .gitignore section
22
Perform a diff compared to the prior snapshotgit diff
23
Perform a diff compared to the prior snapshot and use colorgit diff --colorYou can turn on colors by default in your ~/.gitconfig file
24
Show diff of yellow from common ancestor to the HEAD that will be mergedgit diff ...yellowNote the 3 dots
25
Show list of files from yellow to common ancestor to the HEAD that will be mergedgit diff --name-status ...yellowNote the 3 dots
26
Commit the currently added files with a commit messagegit commit -m 'your message'
27
Commit any modified files that are in the current snapshotgit commit -a -m 'your message'
28
Clear out the pending commit from git addsgit reset HEADIf this fails read the failure message and see what else you need to do. you may need to force a reset if it involved file deletion
29
Reset/revert ALL changes to a working copygit reset --hardThis will reset all changes in your working copy
30
Undo most recent commit on current branch.git reset --hard HEAD~1This will wipe out the prior version completely including history, modifications, etc
31
Remove a file from the repo on the next commitgit rm 'somefile.ext'
32
View the snapshot loggit log
33
Show commits in yellow that would be merged into current branch git log ..yellowNote the 2 dots.
34
Search your current branch for a case sensitive text pattern such as bluegit grep blue
35
Search your current branch for a case insensitive text pattern such as bLuEgit grep -i bLuE
36
View the list of your local branches and your current branchgit branch
37
View the list of all local and remote branches you havegit branch -a
38
View the list of all remote branchesgit branch -r
39
Create a new branch called blue from current snapshot and switch to itgit checkout -b blue
40
Create a new bracnh called yellow from current snapshot but don't switch to itgit branch yellowGenerally git checkout -b will be simpler as you typically want to switch to your new branch
41
Switch to your master branch snapshotgit checkout master
42
Switch to your branch bluegit checkout blue
43
Switch to a remote branch to previewgit checkout origin/somebranchYou shouldn't really make changes here. This puts you in detatched head state. More of a read-only view. Create your own local branch
44
Switch to a remote branch and then branch it for yourselfgit checkout origin/somebranch; git checkout -b your_new_branchThis is a 2 step process.
45
Merge branch blue into your currnet branchgit merge blue
46
Dealing with merge conflictshttp://www.youtube.com/watch?v=ZDR433b0HJY?t=52m50s
47
Delete a branch called yellowgit branch -d yellowLowercase -d is safe delete. Will not delete unique data. Uppercase -D is a forced delete
48
Delete a remote branched called yellowgit push origin --delete yellow
49
Delete a remote branched called yellow (shorthand)git push origin :yellowNotice the colon ( : ) before yellow
50
Remove your local copies of remote branches that are no longer in use from a remote named origingit remote prune origin
51
Ignore further changes to a tracked file (helpful for modifying config/settings files)git update-index --assume-unchanged <file>
52
Undo ignore further changes to a tracked filegit update-index --no-assume-unchanged <file>
53
Recursive add a file extension from the current directorygit add ./\*.jsSpecify a subdirectory by replacing ./ with the folderName/
54
55
Working with Git Remotes
56
Adding a remote named origingit remote add origin https://some.thing.com/yourfiles-git.git
57
58
Managing the .gitignore file
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100