STAY INFORMED
following content serves as a personal note and may lack complete accuracy or
certainty.
Minimal-Mistakes instruction
Useful vscode Shortcut Keys
Unix Commands
npm Commands
Vim Commands
Git Note
Useful Figma Shortcut Keys
Git Note
Commands
Command | Description |
---|---|
git init |
Initialize a new Git repository |
git config user.name 'henry' |
Set the username |
git config user.email 'henry@gmail.com' |
Set the email address |
git add [file name] |
Add file to staging area |
git add [directory name] |
Add all changed files in directory to staging |
git add . |
Add all changed files in working directory to staging |
git reset [option] [file name] |
change HEAD point |
git reset [option] HEAD^ |
change HEAD point to previous file |
git reset [option] HEAD~[n] |
change HEAD point to nth previous file |
git status |
Show the current status |
git commit -m "message" |
Commit staged changes |
git help [command name] |
Show help for a command |
git push -u origin master |
Push to remote repository for the first time |
git push |
Push changes to remote repository |
git pull |
Fetch and merge changes from remote repository |
git clone [URL] |
Clone a repository from GitHub |
git log |
Show commit history |
git log --pretty=oneline |
Show commit history in one line per commit |
git show [commit ID] |
Show changes in a specific commit |
git commit --amend |
Modify the last commit |
git config alias.[alias] [command] |
Set an alias for a command |
git diff [A] [B] |
Compare two commits |
git reset [option] [commit ID] |
Reset to a specific commit |
git tag [tag name] [commit ID] |
Tag a specific commit |
git branch [name] |
Create a new branch |
git checkout -b [name] |
Create and switch to a new branch |
git branch -d [name] |
Delete a branch |
git checkout [name] |
Switch to a branch |
git merge [name] |
Merge a branch |
git merge --abort |
Cancel a merge |
git fetch |
Fetch latest commits from remote |
git blame |
Show who made changes to each line of a file |
git revert |
Revert a specific commit |
git reflog |
Show a log of all references for HEAD |
git log --all --graph |
Show all commits in a graphical format |
git rebase [branch] |
Reapply commits on top of another base commit |
git rebase --continue |
Continue after resolving conflicts during rebase |
git stash |
Save changes temporarily |
git stash apply [ID] |
Apply stashed changes |
git stash drop [ID] |
Remove stashed changes |
git stash pop [ID] |
Apply and remove stashed changes |
git cherry-pick [commit ID] |
Apply a specific commit |
My Set
git config alias.history 'log --pretty=oneline' # assign history to the command
git config pull.rebase true # use rebase method if conflict happens when pull
# deactivate pager
git config --global pager.log false
git config --global pager.diff false
git config --global pager.branch false
git config --global pager.tag false
etc
- If conflict happens, modify conflicted part -> git add . -> git commit