Skip to content

Commit a7f3407

Browse files
committed
📝 Switch from git checkout to git switch
1 parent 74f0d9f commit a7f3407

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

docs/productive/git/branch.rst

+26-26
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ Git branches
3030

3131
.. note::
3232

33-
In Git < 2.23, ``git switch`` is not yet available. In this case you
34-
still need to use ``git checkout``:
33+
In Git < 2.23, ``git switch`` is not yet available. In this case you
34+
still need to use ``git checkout``:
3535

36-
:samp:`$ git checkout [-b] [{BRANCH_NAME}]`
37-
changes the working directory to the specified branch.
36+
:samp:`$ git checkout [-b] [{BRANCH_NAME}]`
37+
changes the working directory to the specified branch.
3838

39-
``-b``
40-
creates the specified branch if it does not already exist.
39+
``-b``
40+
creates the specified branch if it does not already exist.
4141

4242
:samp:`$ git merge {FROM_BRANCH_NAME}`
4343
connects the specified branch with the branch you are currently in, for
4444
example:
4545

4646
.. code-block:: console
4747
48-
$ git checkout main
49-
$ git merge hotfix
50-
Updating f42c576..3a0874c
51-
Fast forward
52-
setup.py | 1 -
53-
1 files changed, 0 insertions(+), 1 deletions(-)
48+
$ git switch main
49+
$ git merge hotfix
50+
Updating f42c576..3a0874c
51+
Fast forward
52+
setup.py | 1 -
53+
1 files changed, 0 insertions(+), 1 deletions(-)
5454
5555
``Fast forward``
5656
means that the new commit immediately followed the original commit and
@@ -60,11 +60,11 @@ Git branches
6060

6161
.. code-block:: console
6262
63-
$ git checkout main
64-
$ git merge 'my-feature'
65-
Merge made by recursive.
66-
setup.py | 1 +
67-
1 files changed, 1 insertions(+), 0 deletions(-)
63+
$ git switch main
64+
$ git merge 'my-feature'
65+
Merge made by recursive.
66+
setup.py | 1 +
67+
1 files changed, 1 insertions(+), 0 deletions(-)
6868
6969
``recursive``
7070
is a merge strategy that is used when the merge is only to be done to
@@ -88,12 +88,12 @@ The history can then look like this, for example:
8888

8989
.. code-block:: console
9090
91-
* 49770a2 (HEAD -> main) Fix merge conflict with my-feature
92-
|\
93-
| * 9412467 (my-feature) My feature
94-
* | 46ab1a2 Hotfix directly in main
95-
|/
96-
* 0c65f04 Initial commit
91+
* 49770a2 (HEAD -> main) Fix merge conflict with my-feature
92+
|\
93+
| * 9412467 (my-feature) My feature
94+
* | 46ab1a2 Hotfix directly in main
95+
|/
96+
* 0c65f04 Initial commit
9797
9898
.. seealso::
9999

@@ -203,7 +203,7 @@ you undo this merge because you realise that it was not finished:
203203

204204
.. code-block:: console
205205
206-
$ git reset --keep @~
206+
$ git reset --keep @~
207207
208208
Later you repeat the merging process:
209209

@@ -251,8 +251,8 @@ Delete branches
251251
``-D`` instead of ``-d`` forcing the deletion.
252252

253253
.. seealso::
254-
* `Git Branching - Branches in a Nutshell
255-
<https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell>`_
254+
* `Git Branching - Branches in a Nutshell
255+
<https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell>`_
256256

257257
Remote branches
258258
---------------

0 commit comments

Comments
 (0)