0

so I am having trouble keeping my git tree clean.

First I am keeping branch for each new feature. Let's say that I create a branch called feature-1

git branch feature-1
git checkout feature-1
git push --set-upstream origin feature-1

Now I made a few commits and pushes and the feature 1 is complete and ready to be merged.

git checkout master
git merge feature-1

So currently feature 1 is merged into master. Now let's say that I screwed something up in the feature 1 without noticing and accidentaly merged it as shown above. And I need to erase every memory that feature 1 even existed.

But if I do

git reset --hard <last commit before branch merged>
git push --force
git branch -D feature-1 #deleting local and remote branch

# but now if I check if feature-1 is deleted
git checkout feature-1
some message like "set up to track remote branch feature-1"

git branch
*feature-1
master

As shown above, the branch feature-1 is still tracekd for some reason and its history with it.

Is there a series of command to prevent this behavior and to completely delete any signs that feature-1 and its commits ever were in the repo?

Thank you

Jasasul
  • 39
  • 3

0 Answers0