Question

Since last 5 years i have been working with SVN and i am new boy to GIT i have few confusions regarding git repository usage for basic operations and by looking at many tutorial and videos could not find my answer, hope some one from here can answer my question.

Steps which i have successfully done using 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 ???

When i have taken update it is not showing remote changes is there any thing i missed ?

I appreciate for the help in advance.

Was it helpful?

Solution

When you git fetch, it doesn't automatically merge the new content into your local branch.

Let's say you are trying to sync your master branch with the remote called origin. When you git fetch, it is grabbing the latest changes of the master branch on the remote repo and stores them in the origin/master branch (in your local repo). This gives you a chance to take a look at the changes (with a diff, for instance) before merging them into your local branch. To merge those changes into your local master branch, you can (while in the master branch):

git merge origin/master

Git has a shortcut command to fetch and merge automatically: git pull. That may be what you're looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top