-
Notifications
You must be signed in to change notification settings - Fork 0
/
CookBook.txt
141 lines (78 loc) · 3.27 KB
/
CookBook.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
##################################################################################################### # System: Ubuntu LTS 16.04
# apt (Advanced Packaging Tool)
#
####################################################################################################
Installation: Command_Line
1. sudo apt install git-all
Check Version:
2. git --version
Set Config:
3. git config --global user.name "Username"
4. git config --global user.email "username@email.com"
5. git config --list
Cloning a Remote Repo (GitHub):
6. git clone https://github.com/robagwe/kick-off-git.git .
# For those who are new to Ubuntu " . at the end of the command indicates the current working directory."
Tracking The Activites:
7. git status
8. git log
9. git diff
Finally, Pushing the Changes To Github Account:
10.1 git add -A
10.2 git add filename
#This command adds the modified file/files to staging.
11. git commit -m "message"
12. git pull origin master
#Buddy, Always make a habit of synchronizing the local repo with a remote one before pushing the changes.
13. git push origin master
#################################################################################################
14. git branch testbranch
# create your own branch and now you are safe even if you fail. :)
15. git checkout testbranch
#To switch to the newly created local branch
16. Follow 10, 11.
#Make changes commit to newly created branch
17. git push origin -u testbranch
#Push this newly craeted branch to remote repo
18. git branch -a
#To See all branches. "*" indicates the current working branch.
Now, we have to sync up our remotely pushed branch with our remote master branch.
19. git checkout master
#To swith to the master local branch
20. git pull origin master
#Buddy, it should become your coding ritual by now.
21. git branch --merged
22. git merge testbranch
23. git push origin master
##################################################################################################
Initializing A Repository From Existing Code:
24. git init
#Buddy, cd to your local repo first :)
25. touch .gitignore
#Buddy, You already know How important is this! If you want certian file/files to be ignored while pushing to remote repo you can make .gitignore file and mention that file extention/name
26. Follow 10, 11
27. Adding an existing project to GitHub using the command line
git init
git add .
git commit -m "First commit"
git remote add origin remote repository URL
git remote -v
git push origin master
##################################################################################################
Deleting Local Git Repo:
# Be careful, dangerous command, it will erase your repository.
# Make sure that you run this from the right folder.
28. rm -rf .git
29. Remove the history from git/github
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
git push -u --force origin master
##################################################################################################
Additional:
> pkill -f anaconda
# to kill all process by a partial name