-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
77 lines (74 loc) · 3.55 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//Lesson1 and more
* Display the entire commit history using the default format. *
git log
* Include which files were altered and the relative number of lines that were added or deleted from each of them. *
git log --stat
* Show changes between two commits. *
git diff <commit id - old> <commit id - new>
* Clone repo located at <repo> onto local machine. Original repo can be located on the local filesystem or on a remote machine via HTML or SSH *
git clone <repo>
* Adds coloured output. *
git config --global color.ui auto
* Define the author name to be used for all commits by the current user. *
git config --global user.name <name>
* Define the author email to be used for all commits by the current user. *
git config --global user.email <email>
* Setting up Sublime Text as the core editor. *
git config --global core.editor "'C:/Program Files/Sublime Text 3/sublime_text.exe' -n -w"
* Creating an alias for Sublime Text in ".bash_profile" file. *
alias subl="'C:/Program Files/Sublime Text 3/sublime_text.exe'"
* Restores project to previously commited version *
git checkout <commit id>
//Lesson2 and more
* Adding a file to the staging area *
git add <file>
* Commits staged files to the repository *
git commit
* Commits staged files, but instead of launching a text editor, use <message> as the commit message. *
git commit -m "<message>"
* List which files are staged, unstaged and untracked. +
git status
* Show unstaged changes between your index and working directory *
git diff
* Compare staged changes with the repository. *
git diff --staged
* Show difference between working directory and last commit. *
git diff HEAD
* Show difference between staged changes and last commit. *
git diff --cached
* Reset staging area to match the most recent commit, but leave the working directory unchanged. *
git reset
* Reset staging area and working directory to match the most recent commit and OVERWRITES ALL CHANGES in the working directory. *
git reset --hard
* Move the current branch tip backward to <commit>, reset the staging area to match , but leave the working directory alone. *
git reset <commit>
* Same as previous, but resets both the staging area & working directory to match. DELETES uncommited changes, and ALL COMMITS AFTER <commit>. *
git reset --hard <commit>
* Restores the "head" to the latest commit in master branch. *
git checkout master
* Show a visual representation of the commit history within branches. *
git log --graph --oneline <branch1> <branch2>
* Condense each commit to a single line. *
git log --oneline
* Limit the number of commits by <limit>. E.g. "git log -5" will limit to 5 commits. *
git log -<limit>
* Create and check out a new branch named <branch>. Drop the -b flag to checkout an existing branch. *
git checkout -b <branch>
* Merge two branches. <branch2> merged into <branch1>. *
git merge <branch1> <branch2>
* Merge <branch> into the current branch. *
git merge <branch>
* List all of the branches in your repo. *
git branch
* Create a new branch with the name <branch> *
git branch <branch>
* Remove <branch>. *
git branch -d <branch>
* Show the changes made in <commit> compared to the previous version, useful after merging branches. *
git show <commit>
* Create new commit that undoes all of the changes in <commit>, then apply it to the current branch. *
git revert <commit>
* Remove <file> from the staging area, but leave the working directory unchanged. This unstages a file without overwriting any changes. *
git reset <file>
* Shows which files would be removed from working directory. use the -f flag instead of -n flag to execute the clean. *
git clean -n