Skip to content

Commit 60f5887

Browse files
committed
add pages/delete.md
1 parent 515178c commit 60f5887

1 file changed

Lines changed: 148 additions & 0 deletions

File tree

‎pages/delete.md‎

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
layout: page
3+
title: Delete a repository
4+
description: How to delete a GitHub repository
5+
---
6+
7+
Say you want to contribute changes to someone else's repository (eg,
8+
[this one](https://github.com/kbroman/github_tutorial)).
9+
10+
- Go to the repository on github. (Say it's by `myfriend`, and is
11+
called `the_repo`, then you'll find it at `https://github.com/myfriend/the_repo`.)
12+
13+
- Click the “Fork” button at the top right.
14+
15+
- You'll now have your own copy of that repository in your github account.
16+
17+
- Open a terminal/shell.
18+
19+
- Type
20+
21+
$ git clone git@github.com:username/the_repo
22+
23+
where `username` is _your_ username.
24+
25+
- You'll now have a local copy of _your version_ of that repository.
26+
27+
- Change into that project directory (`the_repo`):
28+
29+
$ cd the_repo
30+
31+
- Add a connection to the original owner's repository.
32+
33+
$ git remote add myfriend git://github.com/myfriend/the_repo
34+
35+
- Note the distinction between `git@github.com:` in the first case and
36+
`git://github.com/` in the second case. I'm not sure why these need
37+
to be the way they are, but that's what works for me.
38+
39+
- Also note the first myfriend does not need to be the same as the username of `myfriend`. You could very well choose:
40+
41+
$ git remote add repo_nickname git://github.com/myfriend/the_repo
42+
43+
- To check this `remote add` set up:
44+
45+
$ git remote -v
46+
47+
- Make changes to files.
48+
49+
- `git add` and `git commit` those changes
50+
51+
- `git push` them back to [github](https://github.com). These will go
52+
to _your version_ of the repository.
53+
54+
- Note: if you get an error like:
55+
56+
error: src refspec master does not match any.
57+
error: failed to push some refs to 'git@github.com:username/the_repo'
58+
59+
Then try `git push origin HEAD:gh-pages` (see [stackoverflow.](https://stackoverflow.com/questions/4181861/src-refspec-master-does-not-match-any-when-pushing-commits-in-git)). Typing `git show-ref` can show what reference to put after HEAD.
60+
61+
- Go to _your version_ of the repository on github.
62+
63+
- Click the “Pull Request” button at the top.
64+
65+
- Note that your friend's repository will be on the left and _your
66+
repository_ will be on the right.
67+
68+
- Click the green button "Create pull request". Give a succinct and informative title, in the comment field give a short explanation of the changes and click the green button "Create pull request" again.
69+
70+
71+
### Pulling others' changes
72+
73+
Before you make further changes to the repository, you should check
74+
that your version is up to date relative to your friend's version.
75+
76+
Go into the directory for the project and type:
77+
78+
$ git pull myfriend master
79+
80+
This will pull down and merge all of the changes that your friend has
81+
made.
82+
83+
Now push them back to your github repository.
84+
85+
$ git push
86+
87+
88+
### Handling pull requests
89+
90+
Say your friend has suggested some changes to your code.
91+
92+
Ask them to [get a github account](first_use.html) and follow the
93+
instructions above: fork your
94+
repository, make the changes, and submit a pull request.
95+
96+
Once they do that, you'll get an email about it. How to handle it?
97+
98+
#### Using the github website:
99+
100+
- Go to your version of the repository.
101+
102+
- Click on “Pull Requests” at the top.
103+
104+
- Click on the particular request.
105+
106+
- You'll see their comments on the pull request, and can click to see
107+
the exact changes.
108+
109+
- If you want them to make further changes before you merge
110+
the changes into your repository, add a comment.
111+
112+
- If you hate the whole idea, just click the “Close”
113+
button.
114+
115+
- If you want to merge the changes into your repository, click the
116+
“Merge pull request” button.
117+
118+
- Your github repository will now be fixed, but you'll want to get
119+
them into your local repository, too.
120+
121+
- Open a terminal/shell, and type
122+
123+
$ git pull
124+
125+
#### Using the command line
126+
127+
You don't have to use the github website for this.
128+
129+
- Open a terminal/shell.
130+
131+
- Go into the directory for your project.
132+
133+
- Add a connection to your friend's version of the github repository,
134+
if you haven't already.
135+
136+
$ git remote add myfriend git://github.com/myfriend/the_repo
137+
138+
- Pull his/her changes.
139+
140+
$ git pull myfriend master
141+
142+
- Push them back to your github repository.
143+
144+
$ git push
145+
146+
- The pull request on github will be automatically closed.
147+
148+
**Next**: [Handling merge conflicts](merge_conflicts.html)

0 commit comments

Comments
 (0)