-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
173 lines (165 loc) · 7.06 KB
/
index.js
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
var indexApp = angular.module('indexApp', ['ngSanitize']);
indexApp.controller('IndexCtrl', function ($scope) {
$scope.resources =
[
"<a href='http://git-scm.com'>http://git-scm.com</a> - Windows Git client",
"<a href='http://git-scm.com/docs'>http://git-scm.com/docs</a> - Git reference",
'<a href="http://en.wikipedia.org/wiki/Markdown">http://en.wikipedia.org/wiki/Markdown</a> - syntax for creating readme files',
'http://jameswillweb.github.io/github-for-web-designers/reference.html'
];
var cheatSheetOne =
[
new CheatSheetInfo(
'CREATE REPOSITORIES',
'Start a new repository or obtain one from an existing URL',
[
new Sample(
'git init [project-name]',
'Creates a new local repository with the specified name'),
new Sample(
'git clone [url]',
'Downloads a project and its entire version history'
)
]
),
new CheatSheetInfo(
'CONFIGURE TOOLING',
'Configure user information for all local repositories',
[
new Sample(
'git config --global user.name "[name]"',
'Sets the name you want atached to your commit transactions'
),
new Sample(
'git config --global user.email "[email address]"',
'Sets the email you want atached to your commit transactions'
),
new Sample(
'git config --list',
'See git configuration'
),
new Sample(
'git config --global core.editor "[path-to-nodepad++.exe] -multiInst -nosession -noPlugin -notabbar"',
"Configure notepad++ as git editor"
)
]
),
new CheatSheetInfo(
'MAKE CHANGES',
'Review edits and craf a commit transaction',
[
new Sample(
'git status',
'Lists all new or modified files to be commited. Shows difference between working copy, staging index and repository'
),
new Sample(
'git add [file]',
'Adds file to staging area'
),
new Sample(
'git add [filename] --u',
'Adds file(s) that are already in repo to staging area'
),
new Sample(
'git add -A',
'Adds files to staging area, including new'
),
new Sample(
'git diff',
'Shows file differences not yet staged'
),
new Sample(
'git diff --staged',
'Shows file differences of staged files'
),
new Sample(
'git commit -m "[descriptive message]"',
'Commits staged files'
),
new Sample(
'git commit --am "[descriptive message]"',
'Commits with a message and automatically stage all tracked & modified files before the commit'
)
],
[
new Hint(
'Git’s notion of Staging Index',
'set of files to be updated with next commit'
)
]
)
];
var cheatSheetTwo = [
new CheatSheetInfo(
'GROUP CHANGES - BRANCHING',
'Name a series of commits and combine completed efforts',
[
new Sample('git branch', 'Lists all local branches in the current repository & marks current branch'),
new Sample('git branch [branch-name]', 'Creates a new branch',
[
new Hint('After branch is created', 'Creating a branch does not automatically make it active branch. After creating a branch, manual branch switching is required.')
]),
new Sample('git checkout [branch-name]', 'Switches to the specified branch and updates the working directory'),
new Sample('git checkout -b [branch-name]', 'Creates a new branch, switches to it and updates the working directory'),
new Sample('git branch -d [branch-name]', 'Deletes the specified branch',
[
new Hint(
"Git does not allow to delete a branch",
"By default Git does not allow to delete a branch unless it has been merged. To force it use -D."
)])
],
[]
),
new CheatSheetInfo(
'GROUP CHANGES - MERGING',
'',
[
new Sample('git merge [branch]', 'Combines the specified branch’s history into the current branch'),
new Sample(
'git branch --merged',
' This command lists all branches that are included in current branch.'
),
new Sample(
'git branch --no-merge',
' This command lists all branches that are not included in current branch.'
),
new Sample(
'git checkout --theirs -- [file-path]',
'When conflict occurs, this command takes file from branch that was merged. Useful with binary files.')
]),
new CheatSheetInfo(
'GROUP CHANGES - REMOTES',
'',
[
new Sample('git remote add [remote-name] [repository-url]', "Add remote"),
new Sample('git branch -a', 'List local & remote branches'),
new Sample('git branch -r', 'list remote branches (the same as `git remote`)'),
new Sample('git ls-remote', "Display detailed remote branch info"),
new Sample(
'git push -u [remote-name] [branch-name]',
'Pushes [branch-name] to [remote-name]',
[
new Hint(
"push.default",
"Use `push.default` config option to specify a link between local branch and remote eg. git config --global push.default simple." +
"When done, `git push` will suffice to push changes")
])
])
];
$scope.cheatSheets = [cheatSheetOne, cheatSheetTwo];
function CheatSheetInfo(name, desc, samples, hints) {
this.name = name;
this.desc = desc;
this.samples = samples;
this.hints = hints;
}
function Hint(name, desc) {
this.name = name;
this.desc = desc;
}
function Sample(code, desc, hints) {
this.code = code;
this.desc = desc;
this.hints = hints;
}
});