-
Notifications
You must be signed in to change notification settings - Fork 0
/
version_control.txt
98 lines (75 loc) · 1.93 KB
/
version_control.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#####################
#####################
git
#####################
#####################
-----------------------
Basics
-----------------------
# Get the saved username/email
git config user.name
git config user.email
git status
# Add
git add .
# Commit
git commit -m "Commit message"
# Push
git push -u <url> <branch_name>
git push -u origin master
# Git remote add
git remote add origin remote_repository_SSH_URL
git remote -V
------------------
Merge, Pull Fetch
------------------
git fetch <remote>
git merge <remote>/<branch>
# Single command for above two
git pull
-----------------------
Branch
-----------------------
# List of branches
git branch
# Create new branch
git branch <name>
# Switch to another branch
git checkout <name>
# Single command for above two
git checkout -b <name>
# Delete branch locally
git branch -d <local_branch_name>
# Delete branch remotely
git push origin --delete <remote_branch_name>
# Create local branch from existing remote branch
git checkout --track <origin>/<branch>
# Set upstream branch
git branch --set-upstream-to <origin>/<branch>
# PUll changes from parent branch
git merge <child branch> <parent branch>
-----------------------
Revert, Log
-----------------------
# Undo last commit
git reset --soft HEAD~1
#####################
#####################
Github
#####################
#####################
-----------------------
NEW REPO SETUP
-----------------------
# Create a new repository on the command line
echo "# coursera-nlp-specialization-deeplearning.ai" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main #Rename branch name
git remote add origin https://github.com/ivineetm007/coursera-nlp-specialization-deeplearning.ai.git
git push -u origin main
#push an existing repository from the command line
git remote add origin https://github.com/ivineetm007/coursera-nlp-specialization-deeplearning.ai.git
git branch -M main
git push -u origin main