3

I have 2 branches dev & prod. Would like to copy 1 file from dev to prod.

I'm already on the prod branch on remote server.

So i tried

git checkout dev <file-name>

If i do

git checkout dev -- <file-name>

Then it gives

fatal: invalid reference: dev

Jackson
  • 1,218
  • 1
  • 24
  • 53

1 Answers1

0

You need the checkout the other branch and pull down the changes from the server, before trying to get the file from the other branch.

# checkout other branch
git checkout dev

# pull down changes
git pull

# checkout your working branch
git checkout prod

# checkout file from other branch
git checkout dev -- <file-name>
Preston
  • 6,062
  • 6
  • 45
  • 71