Reputation: 33
My work group has a github repo that is just documentation.
I clone that repo to have it local for off line work.
I do not change it or branch it. It gets updated but not branched.
What command do I use to
Upvotes: 3
Views: 123
Reputation: 235
You can use:
git fetch
git status
to check if there are some updates of your remote repository. Git status
will notify you if your repository is behind the remote repository. If you want to get that changes you have to use this command:
git pull
Note: git fetch
download only the changes made to the remote repository; git status
show to you in which phase the files of your local repository are (unregistered, unmodified, modified or staged) and show if there are some differences with the remote repository; git pull
is similar to a shortcut to these command:
git fetch
git merge
i.e. it will download remote repository changes and then updates your local file (it will do a fast-forward update if you don't modify your local files).
More information about Git
can be read here:
I hope this could help you.
Upvotes: 2
Reputation: 142074
If you want to find out if there are differences between your local branch and the remote branch run a diff command
# display changes between local branch to remote
git diff master origin/master
To update all the content of your repository use the fetch command
# Fetch all changes from the remote
git fetch --all --prune
To merge the changes into your branch use the git pull
# merge the changes from the remote to my branch
# git pull is a combination of 2 commands. fetch + merge
# so this single command will fetch (bring) and add (merge) the changes
# made on the remote branch into your branch
git pull origin master
Upvotes: 2
Reputation: 5351
To tell if the remote repo has been modified do the following:
git fetch
git status
The fetch command fetches information about the remote repo, but it does not update your local working files. The status command will tell you if the remote branch is X commits ahead of your local branch.
To pull the changes to the local machine:
git pull
Git will automatically only grab changes. The pull command fetches those changes - as in the answer to number 1 - and also merge those changes into to your local files, so you'll actually "see" the changes.
Upvotes: 1