Question: How to delete a Git branch both locally and remotely?
To remove a local branch from your local system.
git branch -d the_local_branch
To remove a remote branch from the server.
git push origin :the_remote_branch
Question: How do you undo the last commit?
git revert commit-id
Question: How to Edit an incorrect commit message in Git?
git commit --amend -m "This is your new git message"
Question: What are the differences between 'git pull' and 'git fetch'?
Git pull automatically merges the commits without letting you review them first.
Git fetch stores them in your local repository but it not merge them with your current branch.
git fetch similar to guit pull but it does not merge the changes.
Question: How do you rename the local branch?
git branch -m oldBranchName newBranchName
Question: How do I remove local files (Not in Repo) from my current Git branch?
git clean -f -n
Question: How to Checkout remote Git branch?
git checkout test
Question: How do I remove a Git submodule?
git rm the_submodule rm -rf .git/modules/the_submodule
Question: How do you create a remote Git branch?
git checkout -b your_branch_name git push -u origin your_branch_name
Question: How to Change the URL for a remote Git repository?
git remote set-url origin git://this.is.new.url
Question: How to Change the author of a commit in Git?
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='NewAuthorName'; [email protected]'; GIT_COMMITTER_NAME='CommiterName'; [email protected]';" HEAD