Git
Create New Repository
Full Docs : Create a repo - GitHub Docs
Frequently Used
Cancel Local Commits
git reset HEAD~1
Checkout and Create a new branch based on the previous branch
git checkout -b [branch-name]
Move Unstaged Changes to New Branch
git switch -c [new-branch]
Essentials
Branch
# move to a branchgit checkout <branch_name># create and move to a new branchgit checkout -b <branch_name># delete a branchgit branch -d <branch_name># rename a branchgit branch -m <renamed_branch>
Add
# add all changed filesgit add .# add a filegit add <file_relative_path>
Commit
git commit -m "your_commit_message"
Push
# push a branch which already connected and exist in remotegit push# push a branch which doesn't exist on remote yetgit push -u <upstream> <branch_name>
Status
git status
Configurations
# read configured user in current repogit config user.namegit config user.email
# read configured global usergit config --global user.namegit config --global user.email
# configure user in current repogit config user.name "your_name"git config user.email "your_email"
# configure global usergit config --global user.name "your_name"git config --global user.email "your_email"
Initialization
git init