Basic Questions Related to Git.

·

2 min read

#90days DevOps Challenge

My Mentor - Shubhma

  1. Aakash Bhatt

Question: if we have multiple branches and we have to merge at once so we have to do them one by one or we can merge at once??? Ans:

Answer: You can merge multiple branches, and use the commands wisely always. There is a way. Below is an example:

git merge Ex: git merge <b, C>

  1. Tejas Gaikwad

Question: bhai mai re multiple repositery hai , to muze git pai kam karna pade ga to muze harbar ,clone karna pade ga kya mere system par.

Answer: When you have multiple repos in git, you have to clone it once and commit the final code and push it to the remote repo.

  1. Pankaj Manohar Jadhav and Amit Kumar

What's the diff between merge and rebase?

Git Merge and Git Rebase commands are used to combining the work of multiple developers in one code. The end objective for both these commands is the same, but their usage varies.

Let's say you have done 10 commits in your feature branch when you want to send your feature branch changes to the main branch. You have two options

  1. git merge -> In this case, the main branch will receive only 1 commit (combining 10 commits)

  2. git merge -> In this case, the main branch will receive 10 commits
    For more information, you can refer to the link Git Rebase vs Git Merge - Which is better? - Edureka

  1. Mahendra Bora

What is the difference between main and master in git?

Basically, there is no difference between the main and the master. Earlier in git UI it used to be master and they now renamed it to main.

For more information, you can refer to the link GitHub to replace 'master' with 'main' starting next month | ZDNET

  1. Shreya Gupta

What is stash and how to use it, please explain.

Git stash is similar to git commit where git commit is a part of public commit history and git stash stores the most recent changes locally.

Let's say that you are working on the login module, you are halfway through it and not ready to fully commit the changes, meantime you got suddenly one request to fix the signup feature. You can temporarily pause on login module work and fix the signup feature work later come back and restart the work.

Images are taken from google as a reference.

Hope it helped.

Share it with your friends and if any feedback let me know to improve more on this.