我經常從OpenSSL的git回購工作。我測試我所做的更改的其中一項是發行make clean; make dclean
。如何放棄更改?
當我執行git pull
時,git總是失敗,因爲所有用dclean
(見下面)刪除的開發人員cruft。當它失敗時,git告訴我「提交您的更改或隱藏您的更改...」。我對提交,保存或隱藏它們並不感興趣。相反,我想放棄它們。
git abandon
不是命令。什麼是放棄變更的命令?
有關的問題是How do you discard unstaged changes in git?。但答案是把它們藏起來(如果你看了這個問題,你會看到沒有答案,實際上答案這個問題)。但我不喜歡存儲或保存它們。我只是想放棄他們,所以我可以git pull
並回去工作。
$ git pull
remote: Counting objects: 2069, done.
remote: Compressing objects: 100% (872/872), done.
remote: Total 2069 (delta 1022), reused 589 (delta 589), pack-reused 608
Receiving objects: 100% (2069/2069), 3.13 MiB | 1.59 MiB/s, done.
Resolving deltas: 100% (1272/1272), done.
From https://github.com/openssl/openssl
c40dba9..e0f9bf1 master -> origin/master
8a09500..d8a2353 OpenSSL-fips-2_0-dev -> origin/OpenSSL-fips-2_0-dev
155ca14..f16093d OpenSSL_0_9_8-stable -> origin/OpenSSL_0_9_8-stable
690d040..aaa654d OpenSSL_1_0_0-stable -> origin/OpenSSL_1_0_0-stable
76b49a8..cc74177 OpenSSL_1_0_1-stable -> origin/OpenSSL_1_0_1-stable
c59bd61..4d9dc0c OpenSSL_1_0_2-stable -> origin/OpenSSL_1_0_2-stable
* [new tag] OpenSSL-fips-2_0_9 -> OpenSSL-fips-2_0_9
Updating c40dba9..e0f9bf1
error: Your local changes to the following files would be overwritten by merge:
crypto/aes/Makefile
crypto/asn1/Makefile
crypto/bf/Makefile
crypto/bio/Makefile
crypto/buffer/Makefile
crypto/camellia/Makefile
crypto/cast/Makefile
crypto/cmac/Makefile
crypto/cms/Makefile
crypto/conf/Makefile
crypto/des/Makefile
crypto/dh/Makefile
crypto/dsa/Makefile
crypto/dso/Makefile
crypto/ecdh/Makefile
crypto/ecdsa/Makefile
crypto/engine/Makefile
crypto/err/Makefile
crypto/evp/Makefile
crypto/hmac/Makefile
crypto/idea/Makefile
crypto/lhash/Makefile
crypto/md4/Makefile
crypto/md5/Makefile
crypto/mdc2/Makefile
crypto/modes/Makefile
crypto/ocsp/Makefile
crypto/pem/Makefile
crypto/pkcs12/Makefile
crypto/pkcs7/Makefile
crypto/pqueue/Makefile
crypto/rand/Makefile
crypto/rc2/Makefile
crypto/rc4/Makefile
crypto/ripemd/Makefile
crypto/seed/Makefile
crypto/sha/Makefile
crypto/srp/Makefile
crypto/stack/Makefile
crypto/ts/Makefile
crypto/txt_db/Makefile
crypto/ui/Makefile
crypto/whrlpool/Makefile
crypto/x509/Makefile
engines/Makefile
Please, commit your changes or stash them before you can merge.
Aborting
'git的清潔-df && git的結帳--' http://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes -in-git – zedfoxus
謝謝zedfoxus。爲了清楚起見,我使用'git clone'結賬,然後開始工作。我沒有本地副本,因爲OpenSSL只有一組源代碼。所以我直接從克隆工作。因此,我想放棄改變的原因,而不是重新檢查的事情。 (相關:我認爲git是這裏工作的錯誤工具,因爲只有一組來源,不需要增加複雜性)。 – jww
嗨,Jeff,如果你做了'git clone',你就可以在你的系統本地獲得整個遠程回購。 [Git結帳](http://stackoverflow.com/questions/7298598/what-is-the-difference-between-git-clone-and-checkout)不會重新克隆。它在分支之間切換本地副本。 Git是管理OpenSSL源代碼的好工具。有關其他時間的更多信息。 – zedfoxus