git - New branches always point to master -
i'm reading documentation , book when creating new branches forked local repo, no matter how many new branches make, head keeps pointing master , if have 10 branches, making changes in 1 affect of them. tempting remove directory , clone repo again, how deal these problems, once wanna try solve problem. appreciated
making branch
git checkout -b *branchname*
cheking head
git branch -v
everything points 1 place
53f61b4 merged *repository name* master
now after doing changes, lets on branch branchname, , not commiting changes, if switch master
git checkout master
it shows changes made in branchname
when create branch, points commit starts. if use git checkout -b <branchname>
, commit head.
until commit new branch, won't diverge other branches. branch label, , several can point same place. creating branch doesn't generate empty commit or anything.
this described in detail in documentation - there's picture showing situation.
about edit - firstly:
now after doing changes, lets on branch branchname, , not commiting changes, if switch master ... shows changes made in branchname
what mean it shows? shows? did type? you're hiding actual problem in unstated assumption. unless did, , happened, it's unnecessarily hard people you.
secondly:
... shows changes made in branchname
no, no doesn't. still haven't said see, if didn't commit anything, there are no changes on either branch.
what you've done modify working copy. these normal local files.
since both branches point same commit, can switch between them freely without touching working copy. until commit them though changes don't belong branch, , aren't under git's control. they're local files.
use git add
stage changes in index, , see happens when try switch branches.
in general, need add , commit changes git track them.
Comments
Post a Comment