Sunday, November 26, 2017

How do I delete a Git branch both locally and remotely?








To delete Locally - (Normal),
 
git branch -d my_branch
 
If your branch in rebasing/merging progress and that was not done properly means, you will get an error Rebase/Merge in progress so in that case, you won't be able to delete your branch.

So either your need to solve rebasing/merging otherwise you can do force Delete by using,

git branch -D my_branch
 
To delete in Remote:

git push --delete origin my_branch
 
can do the same using ,

git push origin :my_branch   # easy to remember both will do the same.

4 comments:

  1. I was looking for this command lines. Thank you!

    ReplyDelete
  2. Australia Best Tutor is providing online Assignment Help Services for colleges and universities students. Here Students are getting best results and better grades.

    Discount Code : ABT30

    For More Information
    Online Assignment Help
    Assignment Help
    Instant Assignment Help
    My Assignment Help
    Help with Assignment
    Accounting Assignment Help

    ReplyDelete
  3. Best of the interview question on the php language. I think i got the php classes from you.

    ReplyDelete
  4. PHP is a booming sector in IT industry. Grandmaster online provides online training in PHP, Java, Python, Web designing and development all across India.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...