1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

allow user to checkout old files

This commit is contained in:
Jesse Duffield
2019-03-11 09:53:46 +11:00
parent 1ad9c6faac
commit 0e008cc15f
6 changed files with 38 additions and 6 deletions

View File

@ -808,3 +808,9 @@ func (c *GitCommand) ShowCommitFile(commitID, file string) (string, error) {
cmd := fmt.Sprintf("git show --color %s -- %s", commitID, file)
return c.OSCommand.RunCommandWithOutput(cmd)
}
// CheckoutFile checks out the file for the given commit
func (c *GitCommand) CheckoutFile(commitSha, fileName string) error {
cmd := fmt.Sprintf("git checkout %s %s", commitSha, fileName)
return c.OSCommand.RunCommand(cmd)
}