-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit
More file actions
93 lines (69 loc) · 1.98 KB
/
git
File metadata and controls
93 lines (69 loc) · 1.98 KB
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
# git global settings
git config --global user.name "siliconmagi"
git config --global user.email "siliconmagi@yandex.com"
git config -l
# git store credentials
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
# git clone
git clone https://github.com/serverless/serverless-graphql sgraph
# new repo
git init
git add -A
git commit -m "first commit"
git remote add origin git@github.com:siliconmagi/alnasl.git
git push -u origin master
# git pull
# combines git fetch and git merge
git pull
# git update fork with upstream
git remote add upstream https://github.com/davezuko/react-redux-starter-kit
# fetch branches from remote
git fetch upstream
# use master branch
git checkout master
# no rewrite history of my master branch (for those who have cloned mine)
git merge upstream/master
# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:
git rebase upstream/master
# git ignore
# add to .gitignore
node_modules/
# global git ignore
git config --global core.excludesfile '~/.gitignore'
v ~/.gitignore
# reset staged changes
git reset
# reset local commits
git reset HEAD^
# reset local to match repo state
git reset --hard origin/master
# remove file from repo
git rm --cached mylogfile.log
git rm --cached -r mydirectory
# remove prompt for username
v .git/config
url = git@github.com:siliconmagi/nightshell.git
# setting up ssh key for github
ls -al ~/.ssh
//verify the following do not exist
id_dsa.pub
id_ecdsa.pub
id_ed25519.pub
id_rsa.pub
# generate new ssh
ssh-keygen -t rsa -b 4096 -C "siliconmagi@yandex.com"
ssh-add ~/.ssh/id_rsa
# copy ssh to clipboard
sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub
# github add key
settings > ssh and GPG keys > new ssh key > paste key
# config repo for ssh
git@github.com:siliconmagi/genesis.git
# config repo to use https
https://github.com/USERNAME/REPOSITORY.git