开发者

Using GIT with GIT GUI - Master and Branching

开发者 https://www.devze.com 2022-12-14 10:55 出处:网络
I am trying out GIT, and using the GIT GUI (from msysgit) with it. I am trying to make a new branch, but somehow it keeps taking over the master branch. The master branch still appears, but not as th

I am trying out GIT, and using the GIT GUI (from msysgit) with it.

I am trying to make a new branch, but somehow it keeps taking over the master branch. The master branch still appears, but not as the actual master. As a result, I also can't merge my new branch into the master, but it requests me to do the opposite (master into new branch).

Another problem that I have come across (not sure if related), is that GIT GUI is not allowing me to switch between the Master and branch (with chec开发者_C百科k out) without actually merging the two. As far as I understood, this is not a necessary requirement for switching between master and branches.

Thanks...


I've never used gitgui so I can't help you there but you could try performing the same operations at the command line to make sure things are working at that level. To create a branch from the master and check it out at the same time you would use

git checkout -b <new branch name> [old branch name]

Where [old branch name] would be master. If this is omitted the current branch is used. To switch between branches you would use

git branch <destination branch>

To switch to destination branch. You can list all of the existing branches with

git branch -a

Learning to use git at the command line may be a good idea, you're likely to find more documentation for command line use than for gui use.

[edit]

When you say it makes you merge the two branches what error are you getting? git will not allow you to switch off a branch when you have a dirty working copy. If your working copy has changes you either need to commit them or if you don't want to commit your changes you can stash them using the 'git stash' command (you could also reset your head and throw the changes away completely). Is this what you're seeing when you say that git is making you merge the two branches?

0

精彩评论

暂无评论...
验证码 换一张
取 消