I am new to git and a little leary of doing a "git pull". Is there a way to do something like a noop git pull? Something like ...
git pull --noop
... what would show what changes that would occur on my local disk?
Thanks
I am new to git and a little leary of doing a "git pull". Is there a way to do something like a noop git pull? Something like ...
git pull --noop
... what would show what changes that would occur on my local disk?
Thanks
You can use git fetch
. It's not true noop as it have some side effect at your local repo but it updates only remote tracking branches and does not affect your local branches.
Then you can analyze changes in remote tracking branches and decide what to do with your local branches.
I always advise people to avoid git pull
. All git pull
does is:
git fetch
for you, thenBut:
Sometimes it's important to inspect what the second command will do, and you can't do that if you run git pull
.
Sometimes the second command goes wrong, and if you ran it yourself, you will have a much better idea what is going on.
The default for the second command is git merge
, but git rebase
is often a better choice. Even if git merge
is correct, in some Git workflows, it may be important to swap the direction of the merge—i.e., merge your commit(s) into the upstream work, instead of merging the upstream work into your commit(s)—which you can't do with git pull
.
Once you know all of this stuff cold, git pull
may actually be more convenient, since you usually need to do something after git fetch
and typing two commands is, like, so hard, y'know. :-) (And, git pull
has a special corner case built in to it for pulling into an empty repository, but most people don't do that on purpose. That special case used to be broken: it could destroy work. It's fixed now, but that was yet another reason to avoid git pull
entirely.)