pages

Tuesday, 29 December 2020

Git - common commands [part -2]

git fetch what next, what is git pull

git pull is mix of two commands, git fetch and git merge.

git fetch: fetch gets all the changes from remote to your local, now it will be kept. you have to apply those changes on your code.

git merge: git merge origin/master (if you are on your branch) will merge those changes with yours.

git merge vs git rebase

git merge will merge your changes with remote.

git rebase will put yours on top of that.

How to add a local gitconfig

Adding a local gitconfig helps you with keeping different credentials or setting username/ authorname for the repository. You can add one for each repo.

Helpful when you are using multiple git sources(GitHub, BitBucket etc.)

<your-repository-path>\.git\config

git config --local --list to print all the settings.

When Git is not showing commit by your user as “your name”

make sure that you have correct username and email configured.

You can do this globally (for all the projects within your machine) or locally (for just one project)

use flag --global or --local accordingly.

git config --local user.email "abc@gmail.com"

git config --local user.name “abc xyz”

Editing and listing config details.

git config --global --edit

git config --global --list

No comments:

Post a Comment