-
Notifications
You must be signed in to change notification settings - Fork 15
/
siuhong-notes.txt
76 lines (49 loc) · 1.46 KB
/
siuhong-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
==== Section 1: Command Line
========
mkdir [directory-name]
makes a new folder with name [directory-name]
ls
displays a list of files and folders in the current directory
cd [directory-name]
changes directory into [directory-name]
touch [file.extension]
creates a new file with name [file.extension]
cat [filename]
displays the content of [filename]
pwd
displays the folder that you are currently in
==== Section 2: Basic Git Commands
========
git config --global [extension]
changes global configurations
git init
initialize a new git repository
git status
tells us the status of our working directory
git add [filename]
tells git to start tracking a file
moves [filename] to the staging area
git commit -m "MESSAGE" [filename]
commit changes to the repository
moves [filename] from the staging area to the repository
git diff
shows us what has changed between our working directory, staging area and repo
git log
shows us all the commits we made
git log --oneline
shows us all the commits made in oneline
==== Git Summary
========
Commit: Add/updates [file] to/in the Git repo with a relevant message (finalising)
Basic Git workflow:
1. Make changes to [file]
2. Add file to working directory
3. Commit [file] to repo
==== Section 3: Time Travelling
========
git checkout [commit-id]
switches workspace to the version at commit-id
git log --all
shows us all the commits ever made
git checkout master
switches workspace to the most recent commit