Reputation: 119
I have two branches branchA
and branchB
branchB I have made from master branch
Now my branch A has many commits done. But I want to have all the stuff from branchB
. and ignore all mofification , new files etc from branch A
. I don't want to merge but just make the current snapshot of branchB
on A
Upvotes: 0
Views: 69
Reputation: 42919
Well if you want to take a backup you can take a copy from the first branch first, then overwrite the second branch
git checkout branchA
git branch backupA
git reset --hard branchB
And if you want to delete the old branchB
git branch -d branchB #( -D ) for force delete, but I prefer the small `d` first
The result now would be branchA
which contains the content of the old branchB
and a backupA
which contains the content of the old branchA
Upvotes: 0
Reputation: 888303
git reset --hard branchB
This will blow away the complete history of the current branch and replace it with the commit specified.
Use with caution
Upvotes: 3