-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGit_Remote.txt
61 lines (44 loc) · 1.65 KB
/
Git_Remote.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
HELP FOR COMMANDS
git <command> --help
ADDING REPO
git remote add upstream <URL_from_which_fork_is_done>
git remote add origin <Your_fork_URL>
NOTE: origin and upstream are just naming conventions.
GETTING REMOTE INFORMATION
git -v (i.e. verbose <tell me everything you know>)
OUTPUT:
origin https://github.com/Motu-Lootera1701/sandbox.git (fetch)
origin https://github.com/Motu-Lootera1701/sandbox.git (push)
upstream https://github.com/apugoneappu/sandbox (fetch)
upstream https://github.com/apugoneappu/sandbox (push)
NOTE: (fetch) here shows the repository the codes are downloaded from
(push) here shows the repository the codes are uploaded to
REMOVE REMOTE
git rm <remote_name> (e.g. origin)
CHANGE REMOTE URL
git remote <old_url> <remote_name> <new_url>]
TO DOWNLOAD FROM YOUR FORK
git pull <remote_name> <branch_name> (by default put master)
GETTING CURRENT STATUS
git status
PUTTING THINGS IN STAGING AREA
git add <file_name>
NOTE: For adding the entire current directory {git add .}
. here represents all the contents of the current directory
SHORTCUT:
FETCH & PULL
git fetch <remote_name> <branch_name>
This just downloads the changes in the repo fetched from
git pull <remote_name> <branch_name>
This downloads as well as tries to merge the changes
FINDING DIFFERENCE BETWEEN COMMITS
git commit
Link: https://git-scm.com/docs/git-diff
MERGE CONFLICT
Arises when there is descrepency in the files previously present and the files pulled.
MERGING BRANCHES
To merge into any other branch
git merge <source_branch> <>
PUSHING CAHNGES
To push changes
git push <remote> <branch>