From c30e9d807c8d518baa753e0efed025790666ace9 Mon Sep 17 00:00:00 2001 From: Marcello Lamonaca Date: Thu, 20 May 2021 12:21:48 +0200 Subject: [PATCH] Add notes on git reset --- Git/git.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Git/git.md b/Git/git.md index 8e9bf13..eb21d74 100644 --- a/Git/git.md +++ b/Git/git.md @@ -85,7 +85,7 @@ def load_reference(name_or_id): ### Create Repository -`git init []`: initialize a brand new Git repository and begins tracking +`git init []`: initialize a brand new Git repository and begins tracking `.gitignore`: specify intentionally untracked files to ignore ### Config @@ -188,28 +188,28 @@ It’s generally recommended creating annotated tags so it's possible to have al ### Branching And Merging -`git branch`: shows branches +`git branch`: shows branches `git branch -v`: show branch + last commit `git branch `: create new branch `git checkout -b `: create a branch and switches to it, same as `git branch ; git checkout ` `git branch`: show list of all existing branches (* indicates current) `git checkout `: change current branch (update HEAD) and update working directory -`git branch -d `: delete specified branch +`git branch -d `: delete specified branch `git branch -m `: rename a branch without affecting the branch’s history `git merge `: merges into current branch `git merge --continue`: continue previous merge after solving a merge conflinct `git mergetool`: use a fancy tool to help resolve merge conflicts -`git rebase`: rebase set of patches onto a new base +`git rebase`: rebase set of patches onto a new base `git rebase -i`: interactive rebasing `gitk`: show graph of history (git for windows only) ### Undo & [Rewriting History](https://www.themoderncoder.com/rewriting-git-history/) -`git commit --amend`: replace last commit by creating a new one (can add files or rewrite commit message) -`git commit --amend --no-edit`: replace last commit by creating a new one (can add files or rewrite commit message) +`git commit --amend`: replace last commit by creating a new one (can add files or rewrite commit message) +`git commit --amend --no-edit`: replace last commit by creating a new one (can add files or rewrite commit message) `git reset HEAD `: unstage a file `git reset `: undo all commits after specified commit, preserving changes locally `git checkout `: discard changes