github-repo-automation icon indicating copy to clipboard operation
github-repo-automation copied to clipboard

Allow reverts to be supported (or documented)

Open dandhlee opened this issue 3 years ago • 2 comments

Currently, in order to revert any changes made I had to go through the following command:

repo apply --branch name --message header --comment body "git revert --no-commit \$(git log --grep=\"for text you need\" --pretty=format:\"%H\"); git reset"

it took a bit of time to figure out that if you simply only do git reverts, the repo tool looks for changes to make through git status and thus does not work naturally with the way that git revert works, hence that's why I had to add ;git reset. Can this be supported through like repo revert "insert query to match commit"?

If not, having the above documented somewhere could also be great for other folks wishing to do a massive revert.

dandhlee avatar Apr 23 '21 22:04 dandhlee

Thanks for reporting this issue, Dan.

I don't know the repo tool well. To help me understand, could you describe in these terms:

  1. What you did.
  2. What you expected to happen.
  3. What actually happened.

Thanks!

SurferJeffAtGoogle avatar Apr 26 '21 20:04 SurferJeffAtGoogle

Hey Jeff!

  1. Currently we don't support git revert through the repo tool features, so I've went around to use repo apply tool and used its exec feature to use git revert commands through the repositories to successfully revert specific commits.
  2. I would like this to be supported through a command lets say called repo revert rather than having to weave my way around
  3. I've also tried using repo exec but it doesn't automatically create PRs for you so I've had to use repo apply ... as shown above but with a minor tweak so that it complies with how repo apply expects your git branch status to be in. More specifically, git revert naturally goes into committed changes, repo apply tool expects changes to not be committed yet, thus an additional tweak is required. I don't think anything should change for repo apply function, but support for repo revert would be great!

dandhlee avatar Apr 28 '21 15:04 dandhlee