-
Notifications
You must be signed in to change notification settings - Fork 15
/
yanjean-notes.txt
97 lines (65 loc) · 2.04 KB
/
yanjean-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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
==== Section 1: Command Line
mkdir[directory-name]
make new folder with name [directory-name]
ls
displays a list of files and folders in the current folder
cd [directory-name]
go into [directory-name]
touch [file.extension]
creates a new file with name [file.extension]
cat [filename]
displays the contents of the file with
pwd
displays the current working directory
ctrl + L
clears the terminal
==== Section 2: Basic Git
$ git config --global user.name "Yan Jean"
$ git config --global user.email "[email protected]"
$ git config --global --add color.ui true
git init
initialize a new git repository
git status
tells us the status of our working directory
{compares wooden box and current box}
{whatever is not in wooden box is shown in red}
{red: difference between wooden and cardboard box}
{whatever is in your staging area but not in repository}
{green: difference between wooden and metal box}
{working tree clean: everything in metal box}
#git tracks changes as well
git add
tells git to start tracking a file
{move stuff from working directory to the wooden box}
git commit -m "MESSAGE"
commit changes to the repository
{move stuff from wooden box to metal box}
{whatever is in green should}
"MESSAGE" is to tell you the reason for committing
escape + :q!
quit git commit without saving
git diff
everything not in the wooden box
{see what was changed}
git log
shows us all the commits that you have made
{history of changes of your project}
git log --oneline
shows us all the commits in one line
==== Git Summary
Commit:
<finalise changes in the repository>
Basic git workflow:
1. Change {putting stuff into cardboard box}
2. Stage (Add)
3. Finalize (Commit) {a commit is also a noun representing a final change to the file}
git checkout master
git log --all
git reset master
git is a version control, with each version identified by an ID
==== Section 3: Time travelling and multiverse
git checkout [commit-id]
switches workspace to the version at that commit-id
==== Section 4: Git
git push
git clone <link>