-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit_cheatsheet.ps1
61 lines (48 loc) · 1.56 KB
/
git_cheatsheet.ps1
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
#vanilla git
#make local copy of remote branch
git checkout -b {localBranchName} {remoteBranchName}
#delete local and remote branch
git branch -D {branch_name}
git push --delete {usually_origin} {branch_name}
#git rename local branch
git branch -m {new_branch_name}
#git untrack files / folders
git rm --cached {{file_name}}
git rm -r --cached {{folder_name}}
git remote prune origin
#git configs
#win
#user custom ssk key
git config --global core.sshCommand 'ssh -i C:/Users/some-user/.ssh/{key_rsa}'
#macos
git config --global core.autocrlf input
git config --global core.sshCommand 'ssh -i ~/.ssh/{key_rsa}'
chmod 600 ~/.ssh/{key_rsa}
chmod 644 ~/.ssh/{key_rsa}.pub
#tags
git push origin --tags
#github fork update
git remote add upstream {{github_original_repo_url}}
git fetch upstream
git merge upstream/{{branch_name}}
git push
#git flow
#init git flow with it's default options
git flow init -d
#default settings are (some newer git versions do not provision these automatically)
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
bugfix = bugfix/
release = release/
hotfix = hotfix/
support = support/
versiontag = ""
#see gitflows current configs - can be manually seen in .git/config file - all configs for the current repo are keys there
git flow config
#start/finish a new git flow branch
git flow [start] [feature|bugfix|hotfix|release|support] {branchName}
git flow [finish] [feature|bugfix|support] {branchName} --squash
git flow [finish] [hotfix|release] {branchName} --squash --tagname {{tagName}}