Git note.
Git refusing to merge unrelated histories on rebase.
git pull --allow-unrelated-histories
- Create repository.
- Open terminal.
git init
git remote add origin git@github.com:[your repository]
- Before first commit, you should type in the code below.
git pull --rebase origin master
- Update all files.
git add .
git commit -m "message"
git push -u origin master
git log --all --decorate --oneline --graph
If you want it to be a shortcut, you can do it this way.
alias graph="git log --all --decorate --oneline --graph"
graph
All the local committed changes would be dropped and local will be reset to the same as remote origin/master branch.
git reset --hard HEAD~1
To cancel the commit.
git reset @~
git clone -b <branch> <remote_repo>
Reference from GitHub Docs.
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA" --prune-empty --tag-name-filter cat -- --all