r-lib / gert

Simple git client for R
https://docs.ropensci.org/gert/
Other
146 stars 31 forks source link

Add a `file` argument to `git_reset_*()` #220

Open olivroy opened 3 months ago

olivroy commented 3 months ago

so it would be wasier to revert changes to a single file if a commit touched multiple files

git_reset_soft("HEAD~3", file, repo)

to allow to go back to state the a previous for file (3 commits before) but to leave all other files alone. So we can add a commit to revert change to that specific file.

Related to #188. it would be great to be able to cherry-pick changes to a file in a branch to another one.

git reset has pathspec https://git-scm.com/docs/git-reset

Cannot do hard reset with paths however.

Potentially git revert unstaged could be.

git_commit() + git_reset_hard() (revert all uncommited) + git_reset_soft()` (restage files, but uncommit them)