Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-30-2012, 07:05 PM   #1
LQ Newbie
Registered: Apr 2012
Posts: 4

Rep: Reputation: Disabled
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)
Old 05-01-2012, 05:02 AM   #2
Registered: Sep 2004
Location: Germany
Distribution: Gentoo
Posts: 164

Rep: Reputation: 31
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.
Old 05-01-2012, 04:56 PM   #3
LQ Newbie
Registered: Apr 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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:

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!

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

appreciate the attention, psisquare!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i update kernel source from git with my own changes in another branch Richard.Yang Linux - Software 16 09-25-2011 02:26 PM
[SOLVED] Can't install Git repo (I don't git git ) Nemus Linux - Software 3 05-20-2011 03:09 PM
[SOLVED] Copying Individual git Repositories To Master cmnorton Linux - Software 1 10-25-2010 08:18 AM
Git fatal: invalid reference: master fester225 Linux - Virtualization and Cloud 1 01-05-2010 11:41 PM > Forums > Linux Forums > Linux - Software

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration