-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_remote_cheat_sheet.txt
More file actions
25 lines (14 loc) · 1.26 KB
/
git_remote_cheat_sheet.txt
File metadata and controls
25 lines (14 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Overview of commands to work with remote repositories
git clone <url> : creates a copy of a remote repository
git remote -v : show the remote repository from which we cloned the repo
git remote show origin: gives even more informatoin on the origin
git branch -vv : shows which branch you are checking locally. By default you will track the main/master branch in the origin (remote repo)
git show-ref: shows all references local as well as remote
git show-ref master: shows local and remote reference to master branch. you can easily check if the point to the same commit
git fetch origin: tracks the remote repository. Everything that is new gets pulled in our local rep.Also important because it can be used to check that any changes you have made do not conflict with changes of someone else. What you fetch is not part of the local repository until you merge it. you need to solve any merge conflicts before you push them.
git push : pushes local commits to the remote repository
git pull : pulls the latest version from the remote repository.
If changes are made to the local and remote repositories you have to solve potential
merge conflicts.
In order to prevent to be asked for credentials every pull or push you can use:
git config --global credential.helper cache