Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Thilakeswar's full-sized avatar
🎯

ThilakBuddy Thilakeswar

🎯
  • Coimbatore
  • 18:29 (UTC +05:30)
View GitHub Profile
@Thilakeswar
Thilakeswar / Git-RenameBranchName
Created December 12, 2023 09:44
Git - Rename a branch locally and in remote
1. Rename your local branch.
If you are on the branch you want to rename:
git branch -m new-name
If you are on a different branch:
git branch -m old-name new-name
2. Delete the old-name remote branch and push the new-name local branch.
git push origin :old-name new-name
3. Reset the upstream branch for the new-name local branch.
@Thilakeswar
Thilakeswar / ResetAuthorAndCommiterForCommits.txt
Created August 24, 2023 08:14
For resetting both Author and Committer information for Commits of a branch
Step - 1 : Set git user name and password,
i) For setting globally,
->Hit below commands
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "MY_NAME@example.com"
->Alternatively open ~/.gitconfig and add/edit the below information,
[user]
name = FIRST_NAME LAST_NAM
email = MY_NAME@example.com
ii) If you have multiple accounts in Gitlab, Github and using different ones for each of your local repository, you need to update for each repository, if it varies from the global ones.
@Thilakeswar
Thilakeswar / ViCommands.txt
Created June 23, 2023 05:51
Some useful vi commands that I had used
* Search and replace across multiple lines :
:%s/<SearchString>/<ReplaceString>/g
Eg: :%s/Vijay/Thalapathy/g
* Delete multiple lines based on SearchString :
:g/<SearchString>/d
Eg: :g/^Garbage.*$/d
* Delete multiple lines based on range :
:<StartRange>,<EndRange>d
Eg: :1,13d
@Thilakeswar
Thilakeswar / GitBranchNameInTerminal.txt
Created June 23, 2023 05:42
Git Branch name in Terminal path
#According to Apple,
#zsh (Z shell) is the default shell for all newly created user accounts, starting with macOS Catalina.
#Run the command 'echo $SHELL' to find your default shell.
#If result is '/bin/bash', then bash is the default shell else if result is '/bin/zsh', then it's zsh
#Copy the code mentioned below,
#in '~/.bashrc' if bash is your default shell
#in '~/.zshrc' if zsh is your default shell