Skip to content

Commit 8a80dc9

Browse files
authored
Create InClassNotes09March
1 parent 5645427 commit 8a80dc9

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

GIT/InClassNotes09March

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Scenario 1:
2+
3+
git log --oneline
4+
5+
git log --oneline >> filename.txt
6+
7+
git show commitid
8+
9+
Scenario 2:
10+
11+
Take an exisitng file, make change to it. Add the chnages/modification to git
12+
13+
made chnages to file index1.html
14+
git add filename
15+
git commit -m "done"
16+
17+
OR
18+
19+
exiting file is modified
20+
21+
take an exisitng file..make chnages to it
22+
23+
git status
24+
git commit -a -m " added modification"
25+
26+
Scenario 3:
27+
28+
pre req : file should be already exisitng
29+
30+
take a file which is in LR
31+
32+
git ls-files
33+
34+
vim filename ==> add chnages
35+
36+
git status ===> modification
37+
38+
to see the difference of chnages done on a file
39+
40+
git diff filename
41+
42+
43+
to see the difference of chnages done on 2 commits
44+
45+
git diff commitid1 commitd2
46+
47+
********************
48+
49+
Scenario 4:
50+
51+
Delete an exisitng file from Local Repo as well from Working Directory
52+
53+
git rm filename
54+
55+
git commit -m "deletion"
56+
57+
delete file only from local repo
58+
59+
git rm --cached filename
60+
61+
********************
62+
63+
Scenario 5: Revert the changes
64+
65+
$ git revert commitid
66+
67+
68+
*****************
69+
70+
Scenario 6:
71+
72+
Set up the configuration of git repo
73+
74+
$ git config --global user.email mailid
75+
76+
$ git config --global user.name yourName
77+
78+
**********************
79+
80+
Scenario 7 : repeat it for Ramesh
81+
82+
*******
83+
84+
if there are files that you do not want git to track
85+
86+
Create a file .gitignore
87+
88+
add the name of the files that are not required to be tracked by git
89+
90+
save the file
91+
92+
$ git status
93+
94+
$ git add .
95+
96+
$ git commit -m "done"
97+
98+
Scenario is applicable for files that are untacked by git
99+
100+
101+
102+
103+
rm -rf ==> linux command==> delets file from working directory
104+
105+
git rm ==> git command ==> deletes file from WD & local repo
106+
107+
git rm --cached ==> git command ==> deletes file from only local repo
108+

0 commit comments

Comments
 (0)