LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   git branch changes are changing master? (http://www.linuxquestions.org/questions/linux-software-2/git-branch-changes-are-changing-master-942634/)

joejoe99 04-30-2012 06:05 PM

git branch changes are changing master?
 
Hi --

I am learning the revision control software git.

I create the repository, import some files into master, create a branch, checkout the branch, make changes on the branch files, add and commit them, and then return to the master branch and they are also part of the master branch, when I have not merged them.

Am I misunderstanding something w/ git?

I thought you could make changes to your branches and not have those changes go into master right away, or at all unless you merge them in?

Thanks very much! Cant wait to git the basics down! ;0)

psisquare 05-01-2012 04:02 AM

What you describe sounds like it should work as expected. Can you give the exact sequence of commands you used? Maybe there's a subtle error in one of them, or there was an error message you overlooked. You may also want to look at the output of "git branch" at each step and check that you'r really on the branch you think you are, and "gitk --all" in order to see a graphical representation of the state of the repository.

joejoe99 05-01-2012 03:56 PM

psisquare, thanks for the reply!

i dont know what i was doing before produce what i wrote above, but now when i do it like this:

Code:

mkdir gitrepo
cd gitrepo
git init
touch test.txt
git add .
git commit -a
git branch testing
git checkout testing
ls (shows test.txt)
touch testing.txt
ls (shows test.txt and testing.txt)
git add .
git commit -a
git checkout master
ls (shows only test.txt)

so it works exactly how i thought it would and should! :D

thanks and if i notice what i was doing wrong before, ill post back or if i encounter it again.

appreciate the attention, psisquare!


All times are GMT -5. The time now is 03:27 AM.