Skip to content

Commit 822bb50

Browse files
authored
Remove $ sign from gitbootcamp. (GH-297)
* Remove $ sign from gitbootcamp. * Add code-block directives where needed.
1 parent dcdd429 commit 822bb50

File tree

1 file changed

+69
-56
lines changed

1 file changed

+69
-56
lines changed

gitbootcamp.rst

Lines changed: 69 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ Cloning The Forked CPython Repository
3232

3333
You'll only need to do this once. From your command line::
3434

35-
$ git clone [email protected]:<username>/cpython.git
35+
git clone [email protected]:<username>/cpython.git
3636

3737
It is also recommended to configure an ``upstream`` remote::
3838

39-
$ cd cpython
40-
$ git remote add upstream [email protected]:python/cpython.git
39+
cd cpython
40+
git remote add upstream [email protected]:python/cpython.git
4141

4242
You can also use SSH-based or HTTPS-based URLs.
4343

@@ -46,7 +46,7 @@ Listing the Remote Repositories
4646

4747
To list the remote repositories that are configured, along with their URLs::
4848

49-
$ git remote -v
49+
git remote -v
5050

5151
You should have two remotes: ``origin`` pointing to your fork,
5252
and ``upstream`` pointing to the official CPython repository::
@@ -61,10 +61,11 @@ and ``upstream`` pointing to the official CPython repository::
6161

6262
Setting Up Your Name and Email Address
6363
--------------------------------------
64-
::
6564

66-
$ git config --global user.name "Your Name"
67-
$ git config --global user.email [email protected]
65+
.. code-block:: bash
66+
67+
git config --global user.name "Your Name"
68+
git config --global user.email [email protected]
6869
6970
The ``--global`` flag sets these globally,
7071
``--local`` sets them only for the current project.
@@ -78,7 +79,7 @@ The *autocrlf* option will fix automatically any Windows-specific line endings.
7879
This should be enabled on Windows, since the public repository has a hook which
7980
will reject all changesets having the wrong line endings::
8081

81-
$ git config --global core.autocrlf input
82+
git config --global core.autocrlf input
8283

8384
Creating and Switching Branches
8485
-------------------------------
@@ -89,34 +90,34 @@ Creating and Switching Branches
8990
Create a new branch and switch to it::
9091

9192
# creates a new branch off master and switch to it
92-
$ git checkout -b <branch-name> master
93+
git checkout -b <branch-name> master
9394

9495
This is equivalent to::
9596

9697
# create a new branch off 'master', without checking it out
97-
$ git branch <branch-name> master
98+
git branch <branch-name> master
9899
# check out the branch
99-
$ git checkout <branch-name>
100+
git checkout <branch-name>
100101

101102
To find the branch you are currently on::
102103

103-
$ git branch
104+
git branch
104105

105106
The current branch will have an asterisk next to the branch name. Note, this
106107
will only list all of your local branches.
107108

108109
To list all the branches, including the remote branches::
109110

110-
$ git branch -a
111+
git branch -a
111112

112113
To switch to a different branch::
113114

114-
$ git checkout <another-branch-name>
115+
git checkout <another-branch-name>
115116

116117
Other releases are just branches in the repository. For example, to work
117118
on the 2.7 release::
118119

119-
$ git checkout -b 2.7 origin/2.7
120+
git checkout -b 2.7 origin/2.7
120121

121122

122123
.. _deleting_branches:
@@ -126,12 +127,12 @@ Deleting Branches
126127

127128
To delete a **local** branch that you no longer need::
128129

129-
$ git checkout master
130-
$ git branch -D <branch-name>
130+
git checkout master
131+
git branch -D <branch-name>
131132

132133
To delete a **remote** branch::
133134

134-
$ git push origin -d <branch-name>
135+
git push origin -d <branch-name>
135136

136137
You may specify more than one branch for deletion.
137138

@@ -141,40 +142,42 @@ Staging and Committing Files
141142

142143
1. To show the current changes::
143144

144-
$ git status
145+
git status
145146

146147
2. To stage the files to be included in your commit::
147148

148-
$ git add path/to/file1 path/to/file2 path/to/file3
149+
git add path/to/file1 path/to/file2 path/to/file3
149150

150-
3. To commit the files that have been staged (done in step 2)::
151+
3. To commit the files that have been staged (done in step 2):
151152

152-
$ git commit -m "bpo-XXXX: This is the commit message."
153+
.. code-block:: bash
154+
155+
git commit -m "bpo-XXXX: This is the commit message."
153156
154157
155158
Reverting Changes
156159
-----------------
157160

158161
To revert changes to a file that has not been committed yet::
159162

160-
$ git checkout path/to/file
163+
git checkout path/to/file
161164

162165
If the change has been committed, and now you want to reset it to whatever
163166
the origin is at::
164167

165-
$ git reset --hard HEAD
168+
git reset --hard HEAD
166169

167170

168171
Stashing Changes
169172
----------------
170173

171174
To stash away changes that are not ready to be committed yet::
172175

173-
$ git stash
176+
git stash
174177

175178
To re-apply the last stashed change::
176179

177-
$ git stash pop
180+
git stash pop
178181

179182
.. _commit-changes:
180183

@@ -183,11 +186,13 @@ Committing Changes
183186

184187
Add the files you want to commit::
185188

186-
$ git add <filename>
189+
git add <filename>
190+
191+
Commit the files:
187192

188-
Commit the files::
193+
.. code-block:: bash
189194
190-
$ git commit -m '<message>'
195+
git commit -m '<message>'
191196
192197
193198
.. _push-changes:
@@ -200,8 +205,8 @@ them to the remote repository.
200205

201206
::
202207

203-
$ git checkout <branch-name>
204-
$ git push origin <branch-name>
208+
git checkout <branch-name>
209+
git push origin <branch-name>
205210

206211

207212
Creating a Pull Request
@@ -235,9 +240,9 @@ Scenario:
235240

236241
Solution::
237242

238-
$ git checkout master
239-
$ git pull --rebase upstream master
240-
$ git push origin master
243+
git checkout master
244+
git pull --rebase upstream master
245+
git push origin master
241246

242247
The ``--rebase`` option is only needed if you have local changes to the
243248
branch.
@@ -252,10 +257,10 @@ Another scenario:
252257

253258
Solution::
254259

255-
$ git checkout some-branch
256-
$ git fetch upstream
257-
$ git rebase upstream/master
258-
$ git push --force origin some-branch
260+
git checkout some-branch
261+
git fetch upstream
262+
git rebase upstream/master
263+
git push --force origin some-branch
259264

260265

261266
.. _git_from_mercurial:
@@ -273,13 +278,15 @@ Solution:
273278

274279
2. Apply the patch::
275280

276-
$ git apply /path/to/issueNNNN-git.patch
281+
git apply /path/to/issueNNNN-git.patch
277282

278283
If there are errors, update to a revision from when the patch was
279-
created and then try the ``git apply`` again::
284+
created and then try the ``git apply`` again:
280285

281-
$ git checkout `git rev-list -n 1 --before="yyyy-mm-dd hh:mm:ss" master`
282-
$ git apply /path/to/issueNNNN-git.patch
286+
.. code-block:: bash
287+
288+
git checkout `git rev-list -n 1 --before="yyyy-mm-dd hh:mm:ss" master`
289+
git apply /path/to/issueNNNN-git.patch
283290

284291
If the patch still won't apply, then a patch tool will not be able to
285292
apply the patch and it will need to be re-implemented manually.
@@ -291,8 +298,8 @@ Solution:
291298
5. If the patch was applied to an old revision, it needs to be updated and
292299
merge conflicts need to be resolved::
293300

294-
$ git rebase master
295-
$ git mergetool
301+
git rebase master
302+
git mergetool
296303

297304
6. Push the changes and open a pull request.
298305

@@ -312,14 +319,16 @@ On Unix and MacOS, set up the following git alias::
312319

313320
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}" -'
314321

315-
On Windows, reverse the single (`'`) and double (`"`) quotes::
322+
On Windows, reverse the single (`'`) and double (`"`) quotes:
323+
324+
.. code-block:: bash
316325
317326
git config --global alias.pr "!sh -c 'git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}' -"
318327
319328
The alias only needs to be done once. After the alias is set up, you can get a
320329
local copy of a pull request as follows::
321330

322-
$ git pr <pr_number>
331+
git pr <pr_number>
323332

324333

325334
.. _accepting-and-merging-a-pr:
@@ -378,10 +387,12 @@ page. Find the event that says something like::
378387
By following the link to ``<commit_sha1>``, you will get the full commit hash.
379388

380389
Alternatively, the commit hash can also be obtained by the following git
381-
commands::
390+
commands:
382391

383-
$ git fetch upstream
384-
$ git rev-parse ":/bpo-12345"
392+
.. code-block:: bash
393+
394+
git fetch upstream
395+
git rev-parse ":/bpo-12345"
385396
386397
The above commands will print out the hash of the commit containing
387398
``"bpo-12345"`` as part of the commit message.
@@ -425,21 +436,23 @@ To edit an open pull request that targets ``master``:
425436

426437
2. Fetch the pull request, using the :ref:`git pr <git_pr>` alias::
427438

428-
$ git pr <pr_number>
439+
git pr <pr_number>
429440

430441
This will checkout the contributor's branch at ``pr_XXX``.
431442

432443
3. Make and commit your changes on the branch. For example, merge in changes
433444
made to ``master`` since the PR was submitted (any merge commits will be
434-
removed by the later ``Squash and Merge`` when accepting the change)::
445+
removed by the later ``Squash and Merge`` when accepting the change):
446+
447+
.. code-block:: bash
435448
436-
$ git fetch upstream
437-
$ git merge upstream/master
438-
$ git add <filename>
439-
$ git commit -m "<commit message>"
449+
git fetch upstream
450+
git merge upstream/master
451+
git add <filename>
452+
git commit -m "<commit message>"
440453
441454
4. Push the changes back to the contributor's PR branch::
442455

443-
$ git push [email protected]:<contributor>/cpython <pr_XXX>:<branch_name>
456+
git push [email protected]:<contributor>/cpython <pr_XXX>:<branch_name>
444457

445458
5. Optionally, :ref:`delete the PR branch <deleting_branches>`.

0 commit comments

Comments
 (0)