Quick overview to GIT branch and merge

Reading Time: 2 minutes

Hi Readers, In this blog we will be looking about few important GIT commands that becomes very handy in our day to day development routine.

These commands are very useful when you want to contribute to some one’s or you own repository by applying your ideas into the code base.

Let’s discuss few git commands

Cloning a repository

git clone <repo-url>

Create and switch to new branch

git checkout -b <branch-name>

Create new file to branch ‘feature/demo’

vi index.html

Stage the newly created file

git add index.html

Commit the staged file

git commit -a -m ‘<message>’

Check status of scm

git status

Push changes to scm

git push –set-upstream origin feature/demo

Switch to main branch and Merge with main branch

git checkout main then git merge feature/demo

Push changes to main branch

git push

That’s all for this blog. However If you have any doubt, feel free to contact me at nitin.mishra@knoldus.com.

References

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

Thank you for sticking to the end. If you like this blog, please do show your appreciation by giving thumbs ups and share this blog and if you feel, give me suggestions on scope of improvements.

Written by 

Nitin Mishra is a Software Consultant at Knoldus Software LLP. He has done MCA from GGSIPU and completed Bachelor of Science in Computer Science from Delhi University. He is a tech enthusiast with good knowledge of Java. He is majorly focused in DevOps practice. On personal front he loves to travel mountains and writes poetry.

Leave a Reply