How to tell if github repo ahead of my local git cloned repo
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
- tell if the work group repo on github has been modified
- pull just the changes to my local machine?
3 Solutions collect form web for “How to tell if github repo ahead of my local git cloned repo”
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
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 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.
To tell if the remote repo has been modified do the following:
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 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.