Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

git - files checked in Branch-1, showing up in Branch-2

Highlighted

git - files checked in Branch-1, showing up in Branch-2

Expert Contributor

Hello, Here is the scenario :

I've 2 branches created - Branch-b1, Branch-b2 for 2 commits

Both the branches have Different files changed & committed .. when i commit files into b1, the 2 files specific to b1 get committed

Checking in files to Branch-b1

git checkout -b "Branch-b1" 
git add /path/file1.scala 
git add /path/file2.scala 
git commit -m "<Comment>"
git push -u origin "Branch-b1"

However, when i create b2 & commit the 6 files specific to b2, 6 + 5 files are getting committed

Checking in files to Branch-b2

 
git checkout -b "Branch-b2" 
git add /path/file3.scala git 
add /path/file4.scala 
git commit -m "<Comment>" 
git push -u origin "Branch-b2" 

In the second case, what is getting checked in is - files fro Branch-b1 + files from Branch-b2

In fact, when i create a new branch (eg b3) and donot commit any files,

& i do a diff between the branch b3 & master . i see the files checked in for branch b1

eg.

git checkout -b "Branch-b3"
git diff Branch-b3 master 
--- shows the files from Branch-b1
/path/file1.scala 
/path/file2.scala

Any ideas on what i'm doing wrong ? and how to fix this ?

Don't have an account?
Coming from Hortonworks? Activate your account here