Skip to content

Instantly share code, notes, and snippets.

Happily Coding!

Anand Jagadeesh anandjagadeesh

Happily Coding!
View GitHub Profile
anandjagadeesh / git
Last active September 13, 2020 18:49
git config
View git

How to configure name, email, etc in Git!

<...> means variable ---> Fill it with appropriate value and [...] means optional

To configure name for a repo: git config "my name"

To configure name globally: git config --global "my name"

To configure email for a repo: git config user.mail ""

View Delete Branches in

To delete any branch, you shouldn't be on that branch, so switch to another branch before giving the commands

To delete any branch run,

git branch --delete <branch_name>
git branch -d <branch_name>

But this fails if the branch hasn't been merged, so to force delete, if required, run,

anandjagadeesh / Change Author of
Created July 2, 2020 19:51
Change Author For A Commit
View Change Author of

To change the author of a commit, give

git -c"<authorname>" -c<author_email> <commithash> --amend --reset-author
anandjagadeesh / Diffs or files with
Created July 2, 2020 19:49
Showing diffs or files with conflicts during a merge or pull
View Diffs or files with

You can view diffs or just filenames of files with conflicts during a pull or merge

To view diffs of files with conflicts, give:

git diff --diff-filter=U

Or if you have difftool set, for example yadt or vimdiff

anandjagadeesh / Setting Upstream of a
Created July 2, 2020 19:33
Setting Upstream of a Branch
View Setting Upstream of a

To set Upstream of a branch, you can use:

git branch --set-upstream-to origin <branch>

or using the short version

git branch -u origin