Skip to content

Commit c5ceae9

Browse files
committed
updates
1 parent f45610a commit c5ceae9

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

git/GitEYTOC.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,13 @@ Git Branching
648648
git switch second-branch
649649
git log --oneline
650650

651-
git log -n
651+
git log -n #where n is a number
652652
see only the last "n" changes
653653
git log -1
654654
see only the last change
655655

656656
Switching branches
657-
git checkout <branch-name>
657+
git checkout <branch-name> #old way has disadv.
658658
git switch <branch-name>
659659

660660
----------------------
@@ -687,6 +687,8 @@ git switch:
687687
git branch -r
688688
see all local branches
689689
git branch
690+
see all local and remote branches
691+
git branch -a
690692

691693

692694
Rename a branch
@@ -698,6 +700,9 @@ git switch:
698700
----------------------
699701
git push -u origin <local branch>
700702
git push -u origin feature/<name>
703+
This will allow create a pull request
704+
link to create pull reques will be there in the output
705+
701706

702707
Tracking branches
703708
-----------------
@@ -753,6 +758,7 @@ For more information about using git switch:
753758
to associate a local branch (say local) to remote
754759
git switch <branch name>
755760
git push -u origin <branch name>
761+
#will allow to create pull request
756762

757763
N.B: If you get permission denied error
758764
most likely you have configured another user.

git/GitHandsOn.txt

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,22 @@
129129
git checkout -b newissue
130130
Similar to
131131
$ git branch newissue
132-
$ git checkout newissue
132+
$ git checkout newissue #git switch newissue
133133

134134
13. vi index.html
135135
git add .
136136
git commit -m 'Fix issue'
137137

138138
14. git checkout master
139139

140-
15. git checkout -b hotfix
140+
15. git checkout -b hotfix
141+
- instead use git branch and git switch
141142

142143
16. vi index.html
143144
git add *
144145
git commit -a -m 'Any comment'
145146

146-
17. git checkout master
147+
17. git switch master
147148
git merge hotfix
148149

149150
cd .git/logs
@@ -185,7 +186,7 @@
185186
vi m2.txt
186187
Enter some data and save.
187188
git add *
188-
git commit -m "crete 3 files for testing"
189+
git commit -m "create 3 files for testing"
189190

190191
24. Create two different branches.
191192
git branch b1
@@ -340,7 +341,7 @@ confirm if the following is working
340341
sudo apt-get update
341342
sudo apt-get install kdiff3
342343
or
343-
yum install kdiff3
344+
yum install kdiff3 #doesn't work on amazon linux.
344345

345346

346347

@@ -378,18 +379,25 @@ From f1
378379
f1 - feature1 started.
379380
f2
380381
m3
382+
383+
git switch f1
384+
git rebase main
381385

382-
rebase
386+
After rebase f1 would be
383387
m1
384388
m2
385389
m3
386-
?
387-
388-
merge
390+
f1
391+
f2
392+
393+
git switch main
394+
git merge f1
395+
After merge main branch would be
389396
m1
390397
m2
398+
f1
399+
f2
391400
m3
392-
?
393401

394402
-------------------------------------------------------------------------------------
395403
git checkout master
@@ -675,4 +683,5 @@ git checkout -- <file>
675683
Other good references:
676684
1. https://shiivangii.medium.com/all-about-git-and-github-c4b987df1b16
677685
2. https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/
678-
3. https://www.javatpoint.com/git-ignore
686+
3. https://www.javatpoint.com/git-ignore
687+
4. http://swcarpentry.github.io/git-novice/

0 commit comments

Comments
 (0)