GIT主/功能分支的代码库 [英] code base for GIT master/feature branch
问题描述
这可能是我所问过的最愚蠢的问题之一。我正尝试将Git用于其他人设置的项目。我从远程存储库中取出了主分支,并将其分支到我的分支。
问题是我仍然只能看到一个代码库。我是否使用Git Bash切换到我的用户分支并使用相同的代码库?我只是没有得到这个概念,因为我习惯于看到不同分支的不同代码库。
是否我使用Git命令窗口来切换分支,继续处理克隆存储库时获得的代码库,然后完成时,我将它合并回我的本地大师,然后推送到远程?
我得到这个权利吗?
(在下面的所有例子中, foo 是名称的分支)
您只能看到您当前所在分支的代码。要查看分支列表,请键入
git分支
$ b $ 要切换到另一个分支,请输入:
git checkout foo
要删除分支,请输入:
git分支-D foo
要合并两个分支,到其中的一个,然后输入:
git merge foo
这个想法是,您只能看到当前相关的代码(您正在使用的分支)。我发现 Github.com的Git教程很清楚。另一个很好的资源是 Git Community Book 。
<一个重要的注意事项:当你从一个远程仓库中取出时,你将默认只拖动主分支。如果你想拉其他分支,你必须直接指定它们。
This is probably one of the silliest questions i have asked. I'm trying to use Git for a project set up by someone else. I have pulled the "master" branch from the remote repository and I branched it to a "my branch".
The question is that I still see only one code base. Do I use Git Bash to switch to my user branch and work on the same code base? I am just not getting this concept as I'm used to seeing different code bases for different branches.
Is it that I use Git command window to switch the branch, keep working on the code base that I got when I cloned the repository and then when I'm done, i merge it back to my "local" master before pushing to remote?
Did I get this right? Thanks in advance for the help.
(in all the below examples, foo is the name of a branch)
You only see the code for the branch you're currently on. To see a list of branches, type,
git branch
To switch to a different branch, type:
git checkout foo
To delete a branch, type:
git branch -D foo
To merge two branches, change to one of them, then type:
git merge foo
The idea is that you only see the code that is currently relevant (the branch you are working on). I find Github.com's tutorial on Git to be pretty clear. Another good resource is the Git Community Book.
One important note: when you pull from a remote repository, you will be default only pull the Master branch. If you want to pull other branches, you'll have to specify them directly.
这篇关于GIT主/功能分支的代码库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!