Remote repositories in Git
To see the servers from where we got our git repository, run:
git remote (This shows the logical name, not the complete URL)
git remote -v (This shows the complete URL)
To add a remote repository to your local, execute the following command:
git remote add [logical-name] [URL]
The above only adds a pointer to the remote repository, does not fetch it.
To fetch a remote, use:
git fetch [logical-name] (This gets all the files for this remote to your local area)
When a repository is cloned, git automatically adds a logical-name of origin to it.
So if you do git fetch origin, you will get all the changes since you cloned/last-fetched.
Important: fetch command does not do any automatic merge.
Opposite to this behavior is the git pull command which fetches data and also merges it.
To push the changes to [remote-name] from [branch-name], use:
git push [remote-name] [branch-name]
To discard all changes in the local area, use:
git checkout -- <file>
|Email:||(Your email is not shared with anybody)|