自从过去 5 年以来,我一直在使用 SVN,我是 GIT 的新手,我对基本操作的 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 ???
当我进行更新时,它没有显示远程更改是不是我遗漏了什么?
感谢您的提前帮助。
最佳答案
当你git fetch
,它不会自动将新内容 merge 到您的本地分支。
假设您正在尝试同步您的 master
使用名为 origin
的 Remote 进行分支.当你git fetch
, 它正在抓取 master
的最新变化在远程仓库上分支并将它们存储在 origin/master
中分支(在您本地的仓库中)。这使您有机会在将更改 merge 到本地分支之前查看更改(例如,使用 diff
)。将这些更改 merge 到您的本地 master
分支,你可以(在主分支中):
git merge origin/master
Git 有一个快捷命令可以自动获取和 merge :git pull
.这可能就是您正在寻找的。p>
关于用于 Windows checkout 、分支、提交和 pull 更改的 Git gui,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12391685/