Say I already cloned a branch into my local machine, what git command should I use to get the updates of that branch? I don’t want to download or clone the whole thing everytime it gets updated. Thank you!!!
The same as usual:
git pull
it only gets a bit more complicated if you have more remotes (online sources).
2 Likes
That’s all I do:
git stash // to ensure my code not pushed safe
git fetch origin local-branch-name // get changes from origin
git reset --hard origin/local-branch-name
git stash apply // get my code not pushed back
If there’s conflict -> I must process.
This will lose your commits if you made any! Skip the reset part (stash did most of the work anyway).
But there’s really no good reason to not use git-pull, for anyone but advanced users in special cases.
The correct way to do this is first
git stash
and then
git fetch origin branch
git rebase origin/branch
and finally
git stash pop // get back your changes