Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between prunings in git

Tags:

git

Originally, I wanted to delete a remote branch.

git push --delete <branchname>

... did it for me. However, I don't get the difference between the other commands:

git push --prune ...
git prune ...

What are these for? The manual does not help me since it sounds similar and I would have expected them to do what I initially wanted to.

like image 500
Xiphias Avatar asked Feb 02 '16 17:02

Xiphias


1 Answers

git prune acts on your local repository, and it removes objects (e.g. commits and files that are no longer reachable from any branch or tag, or from HEAD). git push --prune acts on the remote repository, and it removes branches that do not exist locally (be really careful with this command, as it will delete all branches that you've never checked out locally; if a branch is known to your local repo only as a remote branch, it'll be deleted remotely).

like image 90
Aasmund Eldhuset Avatar answered Oct 03 '22 06:10

Aasmund Eldhuset