Skip to main content
formatting
Source Link
pkamb
  • 35.7k
  • 27
  • 179
  • 207

1. Rename

If it is your current branch, just do

    git branch -m new_name

If it is another branch you want to rename

    git branch -m old_name new_name

2. Track a new remote branch

- If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

    git push origin :old_name
    git push --set-upstream origin new_name

1. Rename

If it is your current branch, just do

    git branch -m new_name

If it is another branch you want to rename

    git branch -m old_name new_name

2. Track a new remote branch

- If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

    git push origin :old_name
    git push --set-upstream origin new_name

1. Rename

If it is your current branch, just do

git branch -m new_name

If it is another branch you want to rename

git branch -m old_name new_name

2. Track a new remote branch

- If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

git push origin :old_name
git push --set-upstream origin new_name
added 77 characters in body
Source Link
Oss
  • 4.3k
  • 2
  • 22
  • 37
  • If it is your current branch, just do

      git branch -m new_name
    
  • If it is another branch you want to rename

      git branch -m old_name new_name
    
  • If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

      git push origin :old_name
      git push --set-upstream origin new_name
    

1. Rename

If it is your current branch, just do

    git branch -m new_name

If it is another branch you want to rename

    git branch -m old_name new_name

2. Track a new remote branch

- If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

    git push origin :old_name
    git push --set-upstream origin new_name
  • If it is your current branch, just do

      git branch -m new_name
    
  • If it is another branch you want to rename

      git branch -m old_name new_name
    
  • If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

      git push origin :old_name
      git push --set-upstream origin new_name
    

1. Rename

If it is your current branch, just do

    git branch -m new_name

If it is another branch you want to rename

    git branch -m old_name new_name

2. Track a new remote branch

- If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

    git push origin :old_name
    git push --set-upstream origin new_name
Active reading.
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134
  • If it is your current branch, just do

    git branch -m new_name

      git branch -m new_name
    
  • If it is another branch you want to rename

    git branch -m old_name new_name

      git branch -m old_name new_name
    
  • If your branch was pushed, then after renaming you need to delete it from the remote gitGit repository and ask your new local to track a new remote branch.:

    git push origin :old_name
    git push --set-upstream origin new_name

      git push origin :old_name
      git push --set-upstream origin new_name
    
  • If it is your current branch just do

    git branch -m new_name

  • If it is another branch you want to rename

    git branch -m old_name new_name

  • If your branch was pushed, then after renaming you need to delete it from the remote git and ask your new local to track a new remote branch.

    git push origin :old_name
    git push --set-upstream origin new_name

  • If it is your current branch, just do

      git branch -m new_name
    
  • If it is another branch you want to rename

      git branch -m old_name new_name
    
  • If your branch was pushed, then after renaming you need to delete it from the remote Git repository and ask your new local to track a new remote branch:

      git push origin :old_name
      git push --set-upstream origin new_name
    
Source Link
Oss
  • 4.3k
  • 2
  • 22
  • 37
Loading