Is there a difference between "git pull --rebase" and "git fetch && git rebase --autostash FETCH_HEAD"?

Viewed 287

Title says it all. Is there a difference between:

git pull --rebase --autostash

and

git fetch && git rebase --autostash FETCH_HEAD?

And while we're at it, between:

git pull

and

git fetch && git merge?

Thanks!

1 Answers

The below mentioned command

git pull --autostash

will stash your local changes and then perform pull.

pull is a combination of fetch and merge. fetch doesn't merge the remote changes to local branches. So,

git pull

is similar to

git fetch && git merge

Hopefully, this might answer your query.

Related