// If you're currently on the branch you want to rename-
git branch -m new_name
// Or else-
git branch -m old_name new_name
// You can check with-
git branch -a
// As you can see, only the local name changed Now, to change the name also in the remote you must do-
git push origin :old_name
//This removes the branch, then upload it with the new name:
git push origin new_name
// "hello" will be the name of the repo
git init -b hello
git remote remove origin
git remote set-url origin git://new.url.here
git revert <previous label or sha1>
git remote add upstream /url/to/original/repo
git fetch upstream
git checkout main
git reset --hard upstream/main
git push origin main --force
git log --all --decorate --oneline --graph
git checkout -b <branch>
# Edit files, add and commit. Then push with the -u (short for --set-upstream) option:
git push -u origin <branch>
# Git will set up the tracking information during the push.
git push origin main -f
#or
git push -f
git checkout <branch_name>
git rebase -i HEAD~<Count> # count could be anything like HEAD~4
# Then editor will show up
# replace "pick" with "s" or "squash" and then Press ESC and type :wq to save and exit
# then another edior will show up to edit the commit messages
# remove all the commit messages except the first one
# save it using ESC forward by :wq
# then you need to force push it to the github
git push -f # Force push
You can use an npm module called depcheck (requires at least version 10 of Node).
Install the module:
npm install depcheck -g
or
yarn global add depcheck
Run it and find the unused dependencies:
depcheck
The good thing about this approach is that you don't have to remember the find or grep command.
To run without installing use npx:
npx depcheck