Removing a local Git branch that has never been clicked - delete it on the server too?

I created a local branch, but then I realized that I did not need this.

If I delete it from the local repo, should I also delete it from the remote? I just made this thread and didn’t add, didn’t add or add anything to it - in short, I didn’t do anything.

+4
source share
3 answers

If you did not push the branch to the remote computer, you can simply delete it locally:

git branch -d my_branch

. git , , . , , git branch -D my_branch.


, :

git branch -a

:

*  master
   my_branch
   remotes/origin/master

( * )

, "" my_branch, . , ( ).

, :

git push origin :my_branch
+9

, SVN ( ). , . 1. , .

  1. , , , .

, , , .

, , git fetch, , , git branch --all

+2

, , :

;

git branch

:

* your_local_branch (which you want to delete)
  master

Do git checkout master

, ,

git branch -d your_local_branch

( git repo)

git push origin :your_local_branch (if it is pushed)
0

Source: https://habr.com/ru/post/1651012/


All Articles