0

Lately I find myself doing a lot of git rebase -i <commit_hash>^, replace the first 'pick' with an 'e', make the changes I want to the commit, and git rebase --continue.

I was wondering if I could make an alias to automate this process, but I fail to imagine how exactly. Is it possible to send the todo to a shell script, instead of the editor?

The intended result: running git edit <commit_hash> would do the process described above (except for the git rebase --continue), but without the need of me manually choosing the first commit.

3
  • stackoverflow.com/… Commented Oct 29, 2020 at 17:48
  • stackoverflow.com/… Commented Oct 29, 2020 at 17:48
  • 1
    This is it, here's the command I ended up aliasing for future reference: GIT_SEQUENCE_EDITOR="gsed -i '0,/pick/s//e/'" git rebase -i ${1}^ (gsed because I'm on mac) Commented Oct 30, 2020 at 14:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.