git pull - Why does git log not show anything new after git fetch? -
i learning working git remotes reading relevant section of pro git book.
if clone repository, command automatically adds remote repository under name "origin". so, git fetch origin
fetches new work has been pushed server since cloned (or last fetched from) it.
it’s important note git fetch
command fetches data local repository; doesn’t automatically merge of work or modify you’re working on. have merge manually work when you’re ready.
here tried. cloned repository , edited file. in original repository, updated same file , pushed. then,
i ran
git fetch
. showed update progress message. however,git log
did not show update. did misunderstandgit fetch
does? missing something?i ran
git pull
, , got
error: local changes 'hello_world.c' overwritten merge. aborting. please, commit changes or stash them before can merge.
here, believe it's merging , avoid accidental data loss, aborts.
edit: answers. before looking @ answers, trying myself , realized same following commands / outputs:
$ git ls-remote origin d0006a6bfa95e0e90aa820a0e50d31a548625652 head d0006a6bfa95e0e90aa820a0e50d31a548625652 refs/heads/master $ git ls-remote . 14375458b8a6b84f82d9fa4d2ded0bb8c9e87431 head 14375458b8a6b84f82d9fa4d2ded0bb8c9e87431 refs/heads/master d0006a6bfa95e0e90aa820a0e50d31a548625652 refs/remotes/origin/head d0006a6bfa95e0e90aa820a0e50d31a548625652 refs/remotes/origin/master
also following commands:
$git log origin --oneline $git log --oneline
thank bearing stupid questions ;-)
by default, git log
shows log of current branch. since fetching without merging doesn't change in current (local) branch, git log
output doesn't change.
git log
can take --all
option show history of branches, local , remote. alternatively, can explicitly list remote branch in git log origin/master
.
Comments
Post a Comment