Articles → GIT → Commits in multiple branches in gitCommits in multiple branches in gitIn this article, I will show you how to commits are done in multiple branches in git.Let us work on 2 branches i.e. master and dev.Scenario 1 1. Switch to master branch 2. Create a file 1.txt 3. Use following command to commitgit add .
git commit –m “adding 1.txt” 4. Switch to dev branchOutput - 1.txt is not displayed on path where git is mapped.Scenario 2 1. Switch to dev branch 2. Create a file 2.txt 3. Use following command to commitgit add .
git commit –m “adding 2.txt” 4. Switch to master branchOutput - 1.txt is only displayed on path where git is mapped. 2.txt is missing.So the conclusion is the files committed in one branch is exclusive to other one.Posted By - Karan Gupta Posted On - Thursday, August 08, 2019
Your Email Id
Characters remaining 250
git add .
git commit –m “adding 1.txt”
git add .
git commit –m “adding 2.txt”