0

Let's say I have a file named index.html in my master branch, I made some changes of the file in another branch name features. How can I replace the index.html file in the master branch by the index.html file in the features branch

I once tried

> git checkout master
> git merge features

but it seems it copied the content thereby creating redundancies

calebdeji
  • 11
  • 4
  • 3
    You are describing a normal workflow where you merge in a changes, and what you tried is probably the correct approach. Can you elaborate on your last sentence? What do you mean by "copied the content thereby creating redundancies"? – TTT Jul 10 '19 at 17:14

1 Answers1

0

This is the way:

git checkout feature -- index.html
git commit -m "index.html from feature branch"
eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • If this is the correct answer, we should update the question to specify only one file is desired from the features branch. But in that case this is probably just a dup of https://stackoverflow.com/q/2364147/184546. – TTT Jul 10 '19 at 18:57