Repository navigation
Expand file tree
/
Copy pathgithubtutorial.txt
More file actions
105 lines (56 loc) · 2.8 KB
/
Copy pathgithubtutorial.txt
File metadata and controls
105 lines (56 loc) · 2.8 KB
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
96
97
98
99
100
101
102
103
104
git clone link of repo (HTTPS LINK of code changes)
git status: command to get information of repos changes
git add --all or git add -A: is the command to add all changes and remember it in git in the entire project
git reset: it is used to undo changes in git add
git add . :it modified changes in the file that are only in the perticular folder or file
git add * : only remembers the only new fils or modified not deleted onces
git add*.txt/.py/.c/etc : this staged only perticular type of files
Staging is the between step from locally work done to working git memory.
***for first time
enter your email and username
***git config --global user.email email@gmai.command***
git config --global user.name "user-name"***
git rm file.txt : to delete the file
git reset --hard : the change or deleted get reset or come back
fit rm -f file.txt : the file is forceffully deleted
git em --chached file.txt :removes it from Staging
git rm -r folder :
git log : full comment list when and which comment we have created
git log --oneline : short summary of comments
***Branching***
instead of making direct changes on the main branch git make branch to test them before merging it to main branch
secure and organised way to contribute
git branch : to see in which branch you are
git branch branchname :to create new branch in the project
git checkout branchname : to get into the created branch.
git merge main -m "merging main into main branch" :merging the things to main branch or another branch in the github
git comment (coment no.) :it takes you to the place where comment is done
git diff (first comment) (second comment) : it will show the all changes between these two comments
$ to exit the log view you just have to enter 'q'
till now we have staged and commited file locally.
***push,pull,fetch***
Push-> sending loacal changes to the remote
fetch-> bringing remote changes into your local repositories, but not merging them yet
pull-> fetching plus merging so your work diretory immedietly reflects the remote changes
pull = fetch + merge
git push origin main : pushed into main branch
git fetch : change in cloud but not locally
git merge :the cloud change is updated in the locally
|-------------------------| <<-- Push <<-- |-------------|
| github | | local |
|-------------------------| -->> PULL -->> |-------------|
git restore :
git restore file.txt :
git restore services :
git restore . :
git restore --staged filename :
git restore -- staged . :
git stash :temporarily set aside your unfinished work, switch to another branch to do something
git stash pop :
git stash apply :
git stash list :
git stash pop implifier/ADDRESS :
git stash apply implifier/ADDRESS :
git stash list :
git revert :
git rebase :