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 ???

当我进行更新时,它没有显示远程更改我错过了什么吗?

感谢您提前提供帮助。

4

1 回答 1

6

当 you 时git fetch,它不会自动将新内容合并到您的本地分支中。

假设您正在尝试将您的master分支与名为origin. 当 you 时git fetch,它会抓取master远程仓库上分支的最新更改并将它们存储在origin/master分支中(在您的本地仓库中)。这使您有机会在将更改diff合并到本地分支之前查看更改(例如,使用 )。要将这些更改合并到本地master分支中,您可以(在主分支中):

git merge origin/master

Git 有一个快捷命令可以自动获取和合并:git pull. 这可能就是你要找的。

于 2012-09-12T16:07:31.210 回答