Thursday, 17 June 2021

Git Commands used to work with other people's repositories

https://help.github.com/articles/fetching-a-remote/

git clone

git fetch

git merge

git pull

When you are working with other people's repositories:

you may use these commands

These commands are useful working with remote repositories.

git clone :
---------------
to grab a complete copy of a another user's repository - use git clone

$git clone https://www.github.com/USERNAME/REPOSITORY.git


git fetch:
--------------
Use git fetch to fetch the new work done by the other people.

Fetching from a repository grabs all the new remote-tracking (refs/remote/origin/foo referred to as a origin/foo) branches and tags without merging those changes into  your branches.

 git merge:
-----------------

merge combines your local changes with changes made by others.

Typically , you would merge a remote-tracking branch with your local branch

git pull:
--------------
It is a shortcut for both git fetch and git merge in same command

because pull performs a merge on the retrieved changes, you should ensure your local work is commited before running the pull command.

If you run into a merge conflict if you cannot resolve, or if you decide to quit the merge, use git merge --abort to take the branch where it was before you pulled.







No comments:

Post a Comment