Windows下的Git图形界面:检出、分支、提交和拉取更改。

4

过去5年来,我一直在使用SVN,对GIT还不是很熟悉。在进行基本操作时,我有一些困惑,看了很多教程和视频,但没有找到答案。希望这里的某个人能回答我的问题。

我已经成功使用GIT GUI完成了以下步骤。

Step 1- I create two folders on the c: Project-clone-1 and project-clone-2
Step 2- Then i clone Project1(which is on github cloud public server) in 'Project-clone-1' then in 'project-clone-2'

What i want to achieve by creating two copies of same repository is to observe if i commit any change from 'Project-clone-1' and then would like to go to 'project-clone-2' to pull and see if changes comes there.

Step 3- i made some change in a file which is inside 'Project-clone-1' i commit and then pushed.

Please remember i have only master branch.
Step 4- Then i went to the 'project-clone-2' from git GUI i do remote -> Fetch from -> origion
Step 5- it shows Fetching new changes from origin master-> orgin-> master (done)
Step 6- when i opened file which i expect to have change in 'project-clone-2' i still see old file ???

当我更新后,它没有显示远程更改,我是不是错过了什么?提前感谢您的帮助。
1个回答

6
当你执行git fetch命令时,它不会自动将新内容合并到本地分支中。
假设你想要将本地的master分支与名为origin的远程分支同步。当你执行git fetch命令时,它会获取远程仓库master分支的最新更改,并将其存储在origin/master分支(即本地仓库)中。这使你有机会查看更改(例如使用diff),然后再将其合并到本地分支中。要将这些更改合并到本地的master分支中,可以在master分支下执行以下命令: git merge origin/master Git还有一个快捷命令可以自动执行fetch和merge操作:git pull。这可能是你要寻找的。

git pull命令在我执行'git checkout'之前也不会显示远程更改。 - d-man
这意味着你还没有在主分支中,这很奇怪。我建议在学习Git时跳过GUI并使用命令行。GUI往往会混淆事情-更改名称、组合命令等。这使得理解Git实际上正在做什么变得更加困难。不过很高兴你已经解决了问题。 - redhotvengeance

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接