GIT - letronghieu4897/magento GitHub Wiki

GIT

GIT


1. Change branch name

Start by switching to the local branch which you want to rename:

1. git checkout <old_name>
Rename the local branch by typing:

2. git branch -m <new_name>
If you’ve already pushed the <old_name> branch to the remote repository delete the <old_name> remote branch:

3. git push origin --delete <old_name>
Finally, push the <new_name> local branch and reset the upstream branch

4. git push origin -u <new_name>
That’s it. At this point, you have successfully renamed your local and remote Git branch.

2. Config CLI color for git

cd ~
git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
vim ~/.bashrc 

# ADD in endline
GIT_PROMPT_ONLY_IN_REPO=1
source ~/.bash-git-prompt/gitprompt.sh

[[ -s ~/.bashrc ]] && source ~/.bashrc

3. Save username password into git

git config --global credential.helper store

4. Change branch name

https://www.hostinger.com/tutorials/how-to-rename-a-git-branch/

git branch -m new-name

git push origin :old-name new-name

Footer

⚠️ **GitHub.com Fallback** ⚠️