我正在使用git中的2個本地分支,讓我們稱它們爲alerts_v2和。我對A做了一些改變,提交了它們,然後切換到B.我在B中做了一些工作,現在切換回分支A之後,我將遠程分支的文件更改與本地更改混合在一起。所以當我做一個git狀態時,我列出了一大堆我沒有更改的文件。我的目標是讓我的分支與遠程主服務器進行匹配,直到做出更改,然後只有當我執行'git status'時才顯示我的本地更改。Git狀態顯示遠程和本地更改
更新: 我粘貼了reflog的副本。分支alerts_v2對應於上例中的分支A.實際上,我使用了幾個分支,然後切換回alerts_v2,所以分支B實際上代表了幾個分支(但我認爲這不是重要的)。
條目23a03b7是我從alerts_v2移開的位置,而條目f6c143e是我移回的位置。
31b259f [email protected]{1}: origin/master: updating HEAD
74aab0b [email protected]{2}: commit: Blap
31b259f [email protected]{3}: origin/master: updating HEAD
f6c143e [email protected]{4}: checkout: moving from version to alerts_v2
31b259f [email protected]{5}: commit: Added version information popup
b2c9ce3 [email protected]{6}: origin/master: updating HEAD
f0c9b0c [email protected]{7}: commit: Blap
b2c9ce3 [email protected]{8}: origin/master: updating HEAD
abba6bc [email protected]{9}: commit: Blap
b2c9ce3 [email protected]{10}: origin/master: updating HEAD
34ecadc [email protected]{11}: commit: Blap
f3cb5f9 [email protected]{12}: commit: Blap
b2c9ce3 [email protected]{13}: origin/master: updating HEAD
3a8c25d [email protected]{14}: commit: Blap
b2c9ce3 [email protected]{15}: origin/master: updating HEAD
6820bd3 [email protected]{16}: pull : Merge made by recursive.
ad215b1 [email protected]{17}: commit: Blap
27bd651 [email protected]{18}: commit: Blap
e74af44 [email protected]{19}: checkout: moving from e74af44ae40484d837e0295c1622731de1dcb84e to version
e74af44 [email protected]{20}: pull : Fast-forward
76bb1fa [email protected]{21}: checkout: moving from ncli to master2
e74af44 [email protected]{22}: commit: Added download NCLI button
ed2d3c4 [email protected]{23}: origin/master: updating HEAD
9ad842a [email protected]{24}: pull : Merge made by recursive.
b99d663 [email protected]{25}: commit: Added download ncli button
e83d923 [email protected]{26}: origin/master: updating HEAD
719791a [email protected]{27}: commit: Added download NCLI button
9e613d1 [email protected]{28}: commit: Added download ncli button
e83d923 [email protected]{29}: origin/master: updating HEAD
a4d6d42 [email protected]{30}: pull : Merge made by recursive.
39f5fed [email protected]{31}: commit: Add NCLI download capability
76bb1fa [email protected]{32}: checkout: moving from 76bb1fa890089ca732322eba7ad9e74486e2bda1 to ncli
76bb1fa [email protected]{33}: checkout: moving from master to master2
9248d50 [email protected]{34}: commit: Blap
76bb1fa [email protected]{35}: origin/master: updating HEAD
23a03b7 [email protected]{36}: checkout: moving from alerts_v2 to master
f6c143e [email protected]{37}: commit: Blap
8a4b166 [email protected]{38}: commit: Blap
76bb1fa [email protected]{39}: pull : Fast-forward
d245574 [email protected]{40}: pull : Fast-forward
c1e5e92 [email protected]{41}: pull : Fast-forward
b8602a5 [email protected]{42}: commit: Changed Alert event handling
db06232 [email protected]{43}: origin/master: updating HEAD
e807ef7 [email protected]{44}: rebase: Commit
db06232 [email protected]{45}: checkout: moving from alerts_v2 to db06232a413d79fd5607c5618dce8a316efbe84
8cc089f [email protected]{46}: pull : Merge made by recursive.
c74acd9 [email protected]{47}: commit: Commit
4a0c135 [email protected]{48}: commit: Changed the name attribute in the AlertModel to map to Alert Type
ed087cd [email protected]{49}: origin/master: updating HEAD
3db4639 [email protected]{50}: commit: Changed the name attribute in the AlertModel to map to Alert Type
ed087cd [email protected]{51}: origin/master: updating HEAD
ecaea02 [email protected]{52}: commit: Changed the name attribute in the AlertModel to map to Alert Type
ed087cd [email protected]{53}: origin/master: updating HEAD
36323fa [email protected]{54}: pull : Merge made by recursive.
18034e5 [email protected]{55}: commit: Changed AlertMode name attribute to map to Alert Type
a46de98 [email protected]{56}: origin/master: updating HEAD
6fae22b [email protected]{57}: checkout: moving from alerts_patch1 to alerts_v2
8efde4b [email protected]{58}: checkout: moving from alerts_v2 to alerts_patch1
6fae22b [email protected]{59}: commit: Made some changes
a46de98 [email protected]{60}: checkout: moving from a46de98c050cfc8b61b5efccb20d0a271b3959d2 to alerts_v
a46de98 [email protected]{61}: checkout: moving from a46de98c050cfc8b61b5efccb20d0a271b3959d2 to events1
a46de98 [email protected]{62}: commit: Initial implementation of Alert Manager, Namespace Manager and Pol
5cfb8a2 [email protected]{63}: origin/master: updating HEAD
f978dae [email protected]{64}: commit: Initial implementation of Alert Manager, Namespace Manager and Pol
5cfb8a2 [email protected]{65}: origin/master: updating HEAD
這不是很清楚:B是本地還是遠程分支? – Thomas
A和B都是本地分支機構。 – opike
Git不會讓你從B切換到A而沒有提交或隱藏你在B中所做的更改。或者這些更改是純粹未追蹤的(新添加的)文件? – Thomas