git checkout the-other-branch
git reset --hard @{u}
git pull
git clone -b local-branch-name remote-repo-url
e.g. git clone -b local-branch-name https://github.com/lyassa/Git-CookBook.git
git diff local-branch-name remote-branch-name
- git branch -a to list all branches (local and remote)
- choose the branch name from the list, just remove remotes/ from the remote branch name. e.g. git diff master origin/master
git rm --cached <file>
git rm -r --cached <folder>
The removal of the file from the head revision will happen on the next commit. This will not remove the physical file from your local machine, however it will remove the files from other developers' machines on their next git pull.
git branch -a # this will show you all branches, local and remote. The local active branch will have a star. Note the full path of the remote branch, e.g. remotes/origin/master
git rebase <remote-name/remote-branch>
git switch <the-branch-you-want-to-rename>
git branch -m <new-branch-name>
or you can do it in one command
git branch -m <old-name> <new-name>