From 517ce0ea59e6f983702b6a66c6c47b6842e94159 Mon Sep 17 00:00:00 2001 From: thangtd-0050 <49503829+thangtd-0050@users.noreply.github.com> Date: Fri, 2 Oct 2020 22:49:53 +0700 Subject: [PATCH] Add some useful git commands Add some useful git commands, about `git reset --hard`, `git rm --cached`, `git remote rm`, `git log --oneline`, `git commit --amend`, `git show`, `git diff` ... --- tools/git.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/git.sh b/tools/git.sh index c2f3da5..f67bfc7 100644 --- a/tools/git.sh +++ b/tools/git.sh @@ -4,7 +4,9 @@ git clone
# creates a git repo from given address (get the address fro git add file.txt # adds(stages) file.txt to the git git add * # adds(stages) all new modifications, deletions, creations to the git git reset file.txt # Removes file.txt from the stage +git reset --hard # Throws away all your uncommitted changes, hard reset files to HEAD git rm file.txt # removes file.txt both from git and file system +git rm --cached file.txt # only removes file.txt both from git index git status # shows the modifications and stuff that are not staged yet git branch # shows all the branches (current branch is shown with a star) @@ -19,11 +21,19 @@ git cherry-pick