The default name (also known as an alias) for that remote repo is origin. If you've copied a project from Github, it already has an origin. You can view that origin with the command git remote -v, which will list the URL of the remote repo.
Run git fetch (remote) to update your remote refs, it'll show you what's new. Then, when you checkout your local branch, it will show you whether it's behind upstream.
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.
You could git fetch origin
to update the remote branch in your repository to point to the latest version. For a diff against the remote:
git diff origin/master
Yes, you can use caret notation as well.
If you want to accept the remote changes:
git merge origin/master
git remote update && git status
Found this on the answer to Check if pull needed in Git
git remote update
to bring your remote refs up to date. Then you can do one of several things, such as:
git status -uno
will tell you whether the branch you are tracking is ahead, behind or has diverged. If it says nothing, the local and remote are the same.
git show-branch *master
will show you the commits in all of the branches whose names end in master (eg master and origin/master).If you use
-v
withgit remote update
you can see which branches got updated, so you don't really need any further commands.
A good way to have a synthetic view of what's going on "origin" is:
git remote show origin
I just use
git remote update
git status
The latter then reports how many commits behind my local is (if any).
Then
git pull origin master
to bring my local up to date :)
My regular question is rather "anything new or changed in repo" so whatchanged comes handy. Found it here.
git whatchanged origin/master -n 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With