Add file commands

This commit is contained in:
Chalarangelo
2021-04-06 20:58:25 +03:00
parent ee08e62126
commit 58ddef7c3a
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,18 @@
---
title: Copy a file from another branch
tags: branch,intermediate
---
Copies a file from another branch to the current branch.
- Use `git checkout <branch> <file>` to copy the specified `<file>` from the specified `<branch>`.
```sh
git checkout <branch> <file>
```
```sh
git checkout patch-2
git checkout patch-1 "30seconds.txt"
# `patch-2` branch now contains the 30seconds.txt file from `patch-1`
```