當網絡慢時使用git---出現error

Untracked files:
  (use "git add <file>..." to include in what will be committed)


        1.15.txt
        3000word7.txt
        M35MX
        cet/
        field.txt
        fifth-apr-18.lrc
        fifth-apr-18.mp3
        fifth-apr-7.lrc
        fifth-apr-7.mp3
        serciously.txt
        word1.lrc
        word1.mp3
        word2.lrc
        word2.mp3


no changes added to commit (use "git add" and/or "git commit -a")


admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git add .


admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)


        new file:   1.15.txt
        new file:   3000word7.txt
        new file:   M35MX
        new file:   "cet/1 - \345\211\257\346\234\254 (11).q99"
        new file:   "cet/1 - \345\211\257\346\234\254.q99"
        new file:   cet/1.q99
        new file:   cet/1113555718458.zip
        new file:   "cet/1113555718458/\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251/2017\342\224\200\303\23312\303\210\342\224\254\303\213\303\263\303\213\302\264\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251\303\272\302\277\302\245\303\235\303\202\342\226\240\303\272\302\256.doc"
        new file:   "cet/1113555718458/\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251/2017\342\224\200\303\23312\303\210\342\224\254\303\213\303\263\303\213\302\264\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251\303\272\302\277\302\245\303\235\303\212\342\225\227\303\272\302\256.docx"
        new file:   "cet/1113555718458/\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251/2017\342\224\200\303\23312\303\210\342\224\254\342\224\244\302\276\303\220\302\272\303\213\303\263\303\213\302\264\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\224\244\302\255\342\226\221\302\251\342\226\223\342\224\220\303\200\303\215(\303\201\342\224\214\342\225\232\302\262\342\225\240\303\216).docx"
        new file:   cet/16121.q99
        new file:   cet/16122.q99
        new file:   cet/16123.q99
        new file:   cet/17121.q99
        new file:   cet/17122.q99
        new file:   cet/17123.q99
        new file:   cet/1761.q99
        new file:   cet/1762.q99
        new file:   cet/1763.q99
        new file:   cet/20161201.docx
        new file:   cet/2016122.docx
        new file:   cet/2016123.docx
        new file:   cet/2017061.docx
        new file:   cet/2017062.docx
        new file:   cet/2017063.docx
        new file:   cet/20171203.docx
        new file:   cet/2017121.docx
        new file:   cet/2017122.doc
        new file:   field.txt
        new file:   fifth-apr-18.lrc
        new file:   fifth-apr-18.mp3
        new file:   fifth-apr-7.lrc
        new file:   fifth-apr-7.mp3
        modified:   gitword.txt
        new file:   serciously.txt
        new file:   word1.lrc
        new file:   word1.mp3
        new file:   word2.lrc
        new file:   word2.mp3




admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git commit -m "some thing happen"
[master 96447fa] some thing happen
 39 files changed, 1318 insertions(+), 129 deletions(-)
 create mode 100644 1.15.txt
 create mode 100644 3000word7.txt
 create mode 100644 M35MX
 create mode 100644 "cet/1 - \345\211\257\346\234\254 (11).q99"
 create mode 100644 "cet/1 - \345\211\257\346\234\254.q99"
 create mode 100644 cet/1.q99
 create mode 100644 cet/1113555718458.zip
 create mode 100644 "cet/1113555718458/\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251/2017\342\224\200\303\23312\303\210\342\224\254\303\213\303\263\303\213\302\264\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251\303\272\302\277\302\245\303\235\303\202\342\226\240\303\272\302\256.doc"
 create mode 100644 "cet/1113555718458/\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251/2017\342\224\200\303\23312\303\210\342\224\254\303\213\303\263\303\213\302\264\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251\303\272\302\277\302\245\303\235\303\212\342\225\227\303\272\302\256.docx"
 create mode 100644 "cet/1113555718458/\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\225\235\342\226\221\342\224\244\302\255\342\226\221\302\251/2017\342\224\200\303\23312\303\210\342\224\254\342\224\244\302\276\303\220\302\272\303\213\303\263\303\213\302\264\342\225\246\342\224\200\342\225\235\303\202\304\261\302\265\342\225\240\303\224\342\224\244\302\255\342\226\221\302\251\342\226\223\342\224\220\303\200\303\215(\303\201\342\224\214\342\225\232\302\262\342\225\240\303\216).docx"
 create mode 100644 cet/16121.q99
 create mode 100644 cet/16122.q99
 create mode 100644 cet/16123.q99
 create mode 100644 cet/17121.q99
 create mode 100644 cet/17122.q99
 create mode 100644 cet/17123.q99
 create mode 100644 cet/1761.q99
 create mode 100644 cet/1762.q99
 create mode 100644 cet/1763.q99
 create mode 100644 cet/20161201.docx
 create mode 100644 cet/2016122.docx
 create mode 100644 cet/2016123.docx
 create mode 100644 cet/2017061.docx
 create mode 100644 cet/2017062.docx
 create mode 100644 cet/2017063.docx
 create mode 100644 cet/20171203.docx
 create mode 100644 cet/2017121.docx
 create mode 100644 cet/2017122.doc
 create mode 100644 field.txt
 create mode 100644 fifth-apr-18.lrc
 create mode 100644 fifth-apr-18.mp3
 create mode 100644 fifth-apr-7.lrc
 create mode 100644 fifth-apr-7.mp3
 create mode 100644 serciously.txt
 create mode 100644 word1.lrc
 create mode 100644 word1.mp3
 create mode 100644 word2.lrc
 create mode 100644 word2.mp3


admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git push
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (33/33), done.
Connection reset by 13.250.177.223 port 223.00 KiB/s
fatal: The remote end hung up unexpectedly
fatal: sha1 file '<stdout>' write error: Broken pipe
error: failed to push some refs to '[email protected]:pangerger/english.git'


admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)


admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git status
bash: $'\302\203git': command not found

以至於出現這個問題,是在windows端,。

這個時候不要去刪除什麼東西。


在網上看到這個:

版本回退:

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013744142037508cf42e51debf49668810645e02887691000

撤銷修改:

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001374831943254ee90db11b13d4ba9a73b9047f4fb968d000


------------------------------

版本回退:-------------------》》》

先查看git log


若覺得信息太多了就用:

git log --pretty=oneline


得到commit   id



然後使用   git reset --hard HEAD^

表示回到前一個版本


查看所有的提交,用git reflog

這樣回到之前的提交,把太大的東西刪掉,分幾次來提交就不會出現error了。

目前想到的是這個方式。



《《------------------------------------版本回退解決

或許,我應該問,已經commit了,然後不想要了怎麼辦?

https://blog.csdn.net/kongbaidepao/article/details/52253774-----------感覺差不多啊


重點來了:


git reset HEAD^     你已經提交了,但是發現有錯,那麼你回到上次提交,但是代碼還是那個發現有錯的??

git reset --hard HEAD^    所有東西都回到上一次提交的了,嗯,是的,錯誤的東西也沒有了。

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git relog
git: 'relog' is not a git command. See 'git --help'.

Did you mean this?
        reflog

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git reflog
1a97f1d HEAD@{0}: commit: fuck
b0d96d8 HEAD@{1}: reset: moving to HEAD^
96447fa HEAD@{2}: commit: some thing happen
b0d96d8 HEAD@{3}: commit: new readme
8e35fb8 HEAD@{4}: commit: ok,we comefrom dalian university of technology,du wanyi wendy
a1a8d5c HEAD@{5}: commit: ok,gitword again
4c8f627 HEAD@{6}: commit: add gitword.txt
9b618de HEAD@{7}: commit (initial): 1.19

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git reset --hard 964
fatal: ambiguous argument '964': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git reset --hard 96447fa
HEAD is now at 96447fa some thing happen

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git reflog
96447fa HEAD@{0}: reset: moving to 96447fa
1a97f1d HEAD@{1}: commit: fuck
b0d96d8 HEAD@{2}: reset: moving to HEAD^
96447fa HEAD@{3}: commit: some thing happen
b0d96d8 HEAD@{4}: commit: new readme
8e35fb8 HEAD@{5}: commit: ok,we comefrom dalian university of technology,du wanyi wendy
a1a8d5c HEAD@{6}: commit: ok,gitword again
4c8f627 HEAD@{7}: commit: add gitword.txt
9b618de HEAD@{8}: commit (initial): 1.19

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git reset 1a97f1d
Unstaged changes after reset:
M       gitword.txt
D       五上.txt
D       五下.txt
D       五中.txt

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ ls
1.15.txt       3000word4.txt  3000words.txt  fifth-apr-18.lrc  gitword.txt   M35MX           word1.lrc  YV2n3NpSARmX
3000word1.txt  3000word5.txt  cet/           fifth-apr-18.mp3  it/           Normal.dotx     word1.mp3  各路單詞.txt
3000word2.txt  3000word6.txt  CET4,複習.txt  fifth-apr-7.lrc   lession1.txt  readme.md       word2.lrc  四級.xlsx
3000word3.txt  3000word7.txt  field.txt      fifth-apr-7.mp3   log.md        serciously.txt  word2.mp3

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   gitword.txt
        deleted:    "\344\272\224\344\270\212.txt"
        deleted:    "\344\272\224\344\270\213.txt"
        deleted:    "\344\272\224\344\270\255.txt"

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        1.15.txt
        3000word7.txt
        M35MX
        cet/
        field.txt
        fifth-apr-18.lrc
        fifth-apr-18.mp3
        fifth-apr-7.lrc
        fifth-apr-7.mp3
        serciously.txt
        word1.lrc
        word1.mp3
        word2.lrc
        word2.mp3

no changes added to commit (use "git add" and/or "git commit -a")

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git pull
Already up-to-date.

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git push
Everything up-to-date

admin@DESKTOP-KGUDSVD MINGW32 /f/U/FILE/日誌/eng (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   gitword.txt
        deleted:    "\344\272\224\344\270\212.txt"
        deleted:    "\344\272\224\344\270\213.txt"
        deleted:    "\344\272\224\344\270\255.txt"

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        1.15.txt
        3000word7.txt
        M35MX
        cet/
        field.txt
        fifth-apr-18.lrc
        fifth-apr-18.mp3
        fifth-apr-7.lrc
        fifth-apr-7.mp3
        serciously.txt
        word1.lrc
        word1.mp3
        word2.lrc
        word2.mp3

no changes added to commit (use "git add" and/or "git commit -a")


=======

所以我的情況是要git rest commit_id

而不是加 --hard












發佈了89 篇原創文章 · 獲贊 6 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章