自从过去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 ???
当我更新时,它没有显示远程更改是否有任何我错过的内容?
我提前感谢您的帮助。
答案 0 :(得分:6)
当您git fetch
时,它不会自动将新内容合并到您的本地分支。
假设您尝试将master
分支与名为origin
的远程同步。当您git fetch
时,它会抓取远程仓库上master
分支的最新更改并将其存储在origin/master
分支(在您的本地仓库中)中。这使您有机会在将更改合并到本地分支之前查看更改(例如,使用diff
)。要将这些更改合并到本地master
分支,您可以(在主分支中):
git merge origin/master
Git有一个快捷方式命令来自动获取和合并:git pull
。这可能就是你要找的东西。