Reputation: 303
I have three branches - A(branch I am working on), B, C.
The commit history of branches B and C looks like this
Branch B
Branch C
commit c2
commit c1
I have merged these branches into Branch A, So commit history for A looks like this
I want to reset my branch A to commit a1 using git reset --hard a1
. If I do this does commit b1,b2 and c1, c2 gets removed from branches B and C as well or they get removed from only branch A?
Upvotes: 0
Views: 34
Reputation: 879
No, git reset --hard a1
will not change any of the commits on branches B or C. However you will lose the work in commit a2
unless it is saved elsewhere.
Upvotes: 1
Reputation: 4451
A hard reset on Branch A
will affect only that branch. The the other branches will remain unaffected.
To answer your question - After a hard reset of Branch A
with (git reset --hard a1
), the commits b1
and b2
will remain in Branch B
and the commits c1
and c2
will remain in Branch C
.
Upvotes: 1