Ondra Žižka
Ondra Žižka

Reputation: 46796

Git: How to make a file look like in other commit in one step?

Basically, what I want is

git diff HEAD branch1 -- foo.txt > patch.txt;

git apply patch.txt

How do I do this in one step?

And, side question: How can I specify a mask for files, like, **/*.xml?

Upvotes: 0

Views: 67

Answers (1)

Dominik Honnef
Dominik Honnef

Reputation: 18430

You can check out individual files from branches (well, any commit) like this:

git checkout branch1 -- foo.txt

Upvotes: 3

Related Questions