I have deleted a branch on Github but when I push a new commit to a branch with the same name (assuming it should be new), it still lists activity as if its the previously (deleted) one. How can I fully remove a branch on github so this doesn’t occur or force it to create a new branch with the same name?
>Solution :
When I push a new commit to a branch with the same name (assuming it
should be new), it still lists activity as if its the previously
(deleted) one.
Yes, this is just how branches in Git (and on Github) work.
In Git, a branch is nothing but a name (which points to some commit). If you delete a branch in a repository and re-create it, Git has no way of knowing that the branch "feature1" you just re-created is supposed to be different from "feature1" that was deleted yesterday.
There is no way around this. The usual way to resolve this is to not reuse branch names. Re-using branch names is (IMHO) problematic anyway, because it can quickly become confusing. So just do not do this :-).
Note that there is nothing inherently wrong with having long-running and constantly changing branches if you want to – for example, the development of Git itself uses several long-running branches which change regularly ("next", "seen"…). However, if one of these branches is deleted and re-created (which can indeed happen), Git itself will not know about it, therefore the Git project explicitly documents when and how these branches may change, so developers are aware.