Discuss your project
Shell

Delete a branch in git

To completely remove a branch from your git server (including history), simply use the following command:git push origin --delete [branch name]Then you need to run the following command on the instances to remove the information of the deleted branch: git ...

Contrôles avant une opération de gestion de versions

To completely remove a branch from your git server (including history), simply use the following command:

git push origin --delete [branch name]

Then you need to run the following command on the instances to remove the information of the deleted branch:
git fetch --all --prune

If for one reason or another, you need to delete one or more files from previous commits, here is an interesting article on the subject:

https://help.github.com/articles/remove-sensitive-data/

Contrôles avant une opération de gestion de versions

Precautions before executing the order

This tutorial retains the command and the context of its publication. Before using it on a current repository, inspect the branch, the modified files, and the exact target:

git status --short
git log --oneline --decorate -5

Create a backup branch or tag when the operation rewrites history or deletes files. In particular, git reset --hard overwrites the changes in the working directory.

Reference: official documentation of git reset.

Share this article