Skip to content

Commit 43a8628

Browse files
committed
git latest added
1 parent 812741e commit 43a8628

File tree

58 files changed

+2540
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2540
-108
lines changed

git/GitHandsOn.txt

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
$ git <verb> --help
2323
$ man git-<verb>
2424

25-
4. For example, you can get the manpage help for the git config command by running this:
25+
4. For example, you can get the man page help for the git config command by running this:
2626
$ git help config
2727

2828

@@ -85,10 +85,11 @@
8585
---------------------------
8686
add a new file to the repo.
8787
git diff --cached
88-
No impact
88+
difference between working (local repo) directory and staged(index)
89+
It shows you that changes that will be in the next commit.
8990
git diff
90-
More on this latter
91-
git add *
91+
Displays all changes made to the tracked files.
92+
git add .
9293
git diff --cached
9394

9495

@@ -109,17 +110,17 @@
109110
git config user.name
110111
git config <key>
111112

112-
8. git add README test.txt LICENSE
113+
8. git add README.md test.txt LICENSE
113114
git commit -m 'Initial commit'
114115

115116
9. git branch testing
116117

117-
10. git log --oneline --decorate
118+
10. git log --oneline
118119

119120
11. git checkout testing
120121
$ vi test.txt
121122
$ git add test.txt
122-
$ git commit -a -m "made a change"
123+
$ git commit -m "made a change"
123124

124125
12. git checkout master
125126
git checkout -b newissue
@@ -128,27 +129,33 @@
128129
$ git checkout newissue
129130

130131
13. vi index.html
131-
git add *
132-
git commit -a -m 'Fix issue'
132+
git add .
133+
git commit -m 'Fix issue'
133134

134135
14. git checkout master
135136

136137
15. git checkout -b hotfix
137138

138139
16. vi index.html
139140
git add *
140-
git commit -a -m 'Fix broken email address'
141+
git commit -a -m 'Any comment'
141142

142143
17. git checkout master
143144
git merge hotfix
144145

146+
cd .git/logs
147+
cat HEAD
148+
149+
cd .git\logs\refs\heads
150+
cat <branch name>
151+
145152
18. git branch -d hotfix
146153

147154
19. git checkout newissue
148155

149156
20. vi index.html
150157
git add *
151-
git commit -a -m 'Fix the issue'
158+
git commit -m 'Fix the issue'
152159

153160
21. git checkout master
154161

@@ -235,7 +242,7 @@ Modify a COMMITTED file (tracked file)
235242
31.
236243
#Delete the file from the staging and working area.
237244
git status
238-
git rm Efg.txt
245+
git rm Efg.txt #People confuse git rm as the command to stage a removed file.
239246
git status
240247

241248
32.
@@ -393,12 +400,15 @@ From f1
393400
git add .
394401
git commit -m "f1"
395402
git log
396-
m1 and f1 seen in log
403+
History of f1 includes the history before branching of master.
404+
So m1 and f1 seen in log
405+
397406

398407
git checkout master
399408
git log
400409
only m1
401410
no feature file
411+
History after branching in features are not available here.
402412

403413
vi master
404414
m1
@@ -655,4 +665,10 @@ git restore CONTRIBUTING.md
655665

656666

657667

658-
git checkout -- <file>
668+
git checkout -- <file>
669+
670+
671+
Other good references:
672+
1. https://shiivangii.medium.com/all-about-git-and-github-c4b987df1b16
673+
2. https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/
674+
3. https://www.javatpoint.com/git-ignore

0 commit comments

Comments
 (0)