# 1. See your branches | |
$ git branch | |
# 2. Make a new branch, see you're on the new one | |
$ git checkout -b adding-b | |
$ git branch -v | |
# 3. Make a change | |
$ echo "line1" > new-b.txt | |
$ git add new-b.txt | |
$ git commit -m "Added new-b.txt." | |
# 4. Go back to master, change new.txt | |
$ git checkout master | |
$ echo "line2" >> new.txt | |
$ git commit -a -m "Added line2 to new.txt." | |
# 5. Note in git log, the adding-b changes are not in master | |
$ git l | |
# 6. Note we cannot delete adding-b, it is unmerged | |
$ git branch -d adding-b | |
# 7. Merge in adding-b, see the history | |
$ git merge adding-b | |
$ cat new-b.txt | |
$ git l | |
# 8. Now we can delete adding-b branch | |
$ git branch -d adding-b | |
$ git branch -v |
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND
I have completed this.