ajay kumar tiwari
ajay kumar tiwari

Reputation: 26

Remove codebase between two git tags

I have a situation, where

  1. I have a tag v.0
  2. written some new code and push into master.
  3. created a tag v.1.
  4. written some new code and push into master.
  5. created a new tag v.2

Now if I want to remove code written between v.0 and v.1 and I also want to remove tag v.1 How can I achieve this?

Upvotes: 0

Views: 43

Answers (1)

0x5453
0x5453

Reputation: 13589

This requires you to "rewrite history", which is generally considered a bad idea if your repository is public. But essentially you need to make all of these changes locally and then force push your local changes to origin. I believe this would look like:

git rebase -i v.0
# delete the desired range of commits by deleting lines in the `git-rebase-todo` file that is presented
git tag --delete v.1
git push --force-with-lease

Upvotes: 0

Related Questions