Skip to content

Commit 5e457c8

Browse files
committed
last minute changes to git workshop
1 parent f11e451 commit 5e457c8

File tree

1 file changed

+38
-43
lines changed

1 file changed

+38
-43
lines changed

git.markdown

+38-43
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# git
32

43
a way to keep track of changes you make to files. a very
@@ -46,10 +45,11 @@ https://www.youtube.com/watch?v=u2rZLVWOWvs
4645
- `git init`
4746
- `git status` (should be empty)
4847
- `git add doge.png wow.html`
49-
- `git status` (now git is watching these files for changes!)
50-
- `git commit -am "first commit"` (now you've saved a snapshot
51-
of the directory. note: it will only commit changes in the files
52-
you're watching.)
48+
- `git status` (now git is watching these files for
49+
changes!)
50+
- `git commit -am "first commit"` (now you've saved a
51+
snapshot of the directory. note: it will only commit
52+
changes in the files you're watching.)
5353
- `git status` (should be clean)
5454

5555
---
@@ -58,9 +58,9 @@ https://www.youtube.com/watch?v=u2rZLVWOWvs
5858

5959
make a commit for each bit of progress you make.
6060

61-
commit messages help track progress - make nice ones!
62-
it sucks to break something and then have a hard time
63-
finding the last working version!
61+
commit messages help track progress - make nice ones! it
62+
sucks to break something and then have a hard time finding
63+
the last working version!
6464

6565
don't do `git add .` or `git add *` - you will add files
6666
that you didn't mean to add!
@@ -71,21 +71,18 @@ that you didn't mean to add!
7171

7272
`git log`
7373

74-
each commit has a unique identifier called a hash. it'll look
75-
something like this in the log: a5815fb05810bc0ebf53faaa4aba370055bf70d5
74+
each commit has a unique identifier called a hash. it'll
75+
look something like this:
76+
a5815fb05810bc0ebf53faaa4aba370055bf70d5
7677

77-
for a more compact log, do `git log --oneline`. you can also use
78-
the short hashes in that list to look at & revert to
79-
previous versions.
78+
for a more compact log, do `git log --oneline`.
8079

81-
`git show 8d9c7f45ca1f1af59061fa64608666abef6cafd6` shows what changed
80+
`git show 8d9c7f45ca1f1af59061fa64608666abef6cafd6` shows
81+
what changed
8282

83-
to see what the entirety of a file looked like at a
84-
particular commit, do:
83+
to see what one file looked like at a particular commit, do:
8584

86-
```
87-
git show 8d9c7f45ca1f1af59061fa64608666abef6cafd6:file.js
88-
```
85+
`git show 8d9c7f45ca1f1af59061fa64608666abef6cafd6:file.js`
8986

9087
---
9188

@@ -108,22 +105,18 @@ https://www.youtube.com/watch?v=3cMP4oBKO34
108105

109106
# starting a new github repo
110107

111-
github repos live online, on github.com. you can have a
112-
million projects in local git repos and zero activity on
113-
github. to take your local repo and put it online (where it
114-
will live on forever regardless of what happens to your
115-
computer and where others can see your work & possibly even
116-
help you with it!), you first have to go to github.com.
117-
118-
- on github: click the big green "new repository" button and
119-
follow the steps. NOTE: do not make a README.
120-
- on github: once your new github repository is ready, the
121-
site will show your new repo & display its git url. it
122-
will look something like this:
108+
github repos live on github.com. you can have a million
109+
projects in local git repos and zero activity on github. to
110+
put your local repo online, first go to github.com.
111+
112+
- on github: click the "new repository" button NOTE: do not
113+
make a README.
114+
- on github: once your new repo is ready, the site will show
115+
its git url. it will look like:
123116
`[email protected]:cyberwizardinstitute/course-map.git`
124-
- in terminal do: `git remote add origin
117+
- in terminal: `git remote add origin
125118
[email protected]:cyberwizardinstitute/course-map.git`
126-
- in terminal do: `git push origin master`
119+
- in terminal: `git push origin master`
127120

128121
now, when you go to your repo on github, it should have the
129122
contents of your last commit.
@@ -143,14 +136,15 @@ directly to them.
143136
- check that everything has copied with `ls`
144137
- make whatever changes you want
145138
- `git status`
146-
- `git commit -am "adding xyz"` (this makes a commit on your
147-
local machine)
148-
- `git push origin master` (this pushes your changes back up
149-
to github)
139+
- `git commit -am "adding xyz"` (make a commit on your local
140+
machine)
141+
- `git push origin master` (push your changes back up to
142+
github)
150143

151144
---
152145

153-
# collaborating on existing github projects (w/o push access)
146+
# collaborating on existing github projects (w/o push
147+
# access)
154148

155149
for existing github projects that you'd like to work on but
156150
that you don't have push access to, or where you'd like your
@@ -160,7 +154,8 @@ branch.
160154
- on github, fork the repo you want to work with. (this will
161155
give you your own copy of the repo on github, but not on
162156
your local machine).
163-
- on github, go to your own fork of the repo and find the git url to clone the repo.
157+
- on github, go to your own fork of the repo and find the
158+
git url to clone the repo.
164159
- in terminal: `git clone xyz.git` (this pulls your forked
165160
copy to your local machine)
166161
- check that everything has copied with `ls`
@@ -183,8 +178,8 @@ shared github repo, do `git pull origin master` to make sure
183178
that you have the most up to date version of the repo.
184179

185180
many existing open source projects have code review before
186-
your pull request can be merged. this is why it's a
187-
good idea to fork and work on your own branch of an existing
181+
your pull request can be merged. this is why it's a good
182+
idea to fork and work on your own branch of an existing
188183
project.
189184

190185
---
@@ -195,5 +190,5 @@ Your homework is to do the git-it workshop on nodeschool:
195190

196191
http://nodeschool.io/#gitit
197192

198-
and to submit a pull request to a project with a useful fix or
199-
addition.
193+
and to submit a pull request to a project with a useful fix
194+
or addition.

0 commit comments

Comments
 (0)