新建的倉庫在上傳本地專案時,需要先拉取git端建立的readme.md
等本地不存在的檔案,git pull
之後本地的檔案卻被覆蓋掉,那麼怎麼辦呢?
git reflog
可以檢視該git專案的操作日誌,結果如下:
$ git reflog
3405d7a (head, origin/master) head@: reset: moving to 3405d7a
a508484 (master) head@: reset: moving to a508484
3405d7a (head, origin/master) head@: pull --rebase origin master: checkout 3405d7a7664c7975b565a6cdb0e26268333a0ecd
a508484 (master) head@: commit (initial): first commit
git reset --hard head@
head為版本號,就前面那一串數字,n是你要回退到的引用位置)
$ git reset --hard a508484
updating files: 100% (56/56), done.
head is now at a508484 first commit
ok!呼!done!
ref
git pull和本地檔案衝突
同事在使用git pull 時,經常會碰到有衝突的情況,提示如下資訊 error your local changes to c environ.c would be overwritten by merge.aborting.please,commit your changes or stash ...
git pull和本地檔案衝突
使用git pull 時,經常會碰到有衝突的情況,提示如下資訊 error your local changes to c environ.c would be overwritten by merge.aborting.please,commit your changes or stash the...
git pull 和本地檔案衝突
在使用git pull 時,經常會碰到有衝突的情況,提示如下資訊 error your local changes to c environ.c would be overwritten by merge.aborting.please,commit your changes or stash th...