Made a typo or wrong description in a commit message? Run and edit:
git commit --amend
git commit --amend --reuse-message HEAD
#or
git commit --amend --no-edit
git reset <filename>
If you already have committing the file:
git reset --soft HEAD~1
get reset <filename>
rm <filename>
git commit
git branch
git checkout -b newbranch
git branch -m <oldname> <newname>
#If you want to rename the current branch, you can do:
git branch -m <newname>
git branch -d <branchname>
# To force delete use -D
# List all remote
git branch -r
# Checkout
git checkout -b LocalName origin/remotebranchname
git checkout master
git merge <featurebranch>
git checkout <featurebranch>
git rebase master
git fetch --all
git reset --hard origin/master
#git reset --hard origin/<branch_name>
git remote -v
#origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
#origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
git remote -v
#origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
#origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
#upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
#upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
git fetch upstream
git checkout master
git merge upstream/master
git fetch origin pull/ID/head:BRANCHNAME
git checkout BRANCHNAME
git push origin BRANCHNAME
#or merge
git branch --set-upstream-to=origin/BRANCHNAME BRANCHNAME
git pull
#resolve
Rebase a remote branch locally (named devel)
git checkout devel
git fetch upstream
git merge upstream/devel
# or??
git rebase devel upstream/devel
git reflog
Review the output. Find the commit/item and note the identification number, e.g. 3a5f876. Now reset the git HEAD:
git reset HEAD@<identification number>
curl -i https://git.io -F "url=https://github.com/..."