Reputation:
I am using Git. I am working on branch-A with uncommitted changes which i do not want to commit now. Lets us say there is a file with name new_file. I want to overwrite the new_file of the branch-A with the new_file of branch-B's history(i.e. not the latest version of new_file on branch-B)
Upvotes: 0
Views: 79
Reputation: 561
git checkout B~N -- new_file
Where B is the branch and N is the number of revisions back in branch-B's history you want to go.
For example:
git checkout B~10 -- new_file
will checkout new_file from 10 commits back in the history of branch B.
Or if you have the hash just
git checkout <hash> -- new_file
for example:
git checkout 6cdd6ef37 -- new_file
Upvotes: 2