我正在使用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