aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-05-13 19:17:40 +0100
committerChristopher Baines <mail@cbaines.net>2018-05-13 21:09:53 +0100
commit0126aa2af17af50d0cbfbc7ba6eb70bd974e295b (patch)
treed7e998fd121632cf13315380633911b275e67412
parentf1eacc9218254ebc83ee0653118d3cdd3139128a (diff)
downloadmagit-tutorial-0126aa2af17af50d0cbfbc7ba6eb70bd974e295b.tar
magit-tutorial-0126aa2af17af50d0cbfbc7ba6eb70bd974e295b.tar.gz
Add a section on Using branches, and expand Pushing
-rw-r--r--README.org48
1 files changed, 47 insertions, 1 deletions
diff --git a/README.org b/README.org
index 93c3560..6d06b1d 100644
--- a/README.org
+++ b/README.org
@@ -122,7 +122,30 @@ From the Magit status window, press =y= to get an overview of your
local branches, and those on all of the remotes. Press =q= to return
to the Magit status window.
-* Pushing
+* Using Branches
+
+** Creating a new branch
+
+To create a new branch, from the Magit status window, press =b= and
+then =c=, then select the starting point, in this case, use the
+default =master=, so just press =RET=. After that enter =test-branch=
+as the branch name and press =RET= once more.
+
+Your now working on the =test-branch= branch. At the top of the Magit
+status window, you should see the branch name displayed.
+
+** Switching branches
+
+To switch branch press =b= and then =b= again. In this case, switch
+back to the =master= branch, so just press =RET= when prompted for the
+branch to switch to.
+
+* Pushing [[info:magit#Pushing][(documentation)]]
+
+For experimenting with pushing, switch back to the =test-branch=
+branch ([[*Switching branches][notes]]).
+
+** Explicit pushing
To push, from the Magit status window press =P=. For the purposes of
this tutorial, lets push the master branch of the local repository to
@@ -130,6 +153,29 @@ a branch called =test-branch= in the =test= remote. To do this, after
pressing =P=, select =e= for elsewhere, then enter =test/test-branch=
and press =RET=.
+** Setting the upstream branch
+
+Explicit pushing is useful, but usually you'll be pushing to a single
+main remote. When doing this, it can be useful to set the "upstream"
+branch, and have Git remember this.
+
+Press =P= to begin pushing as before, then =u= to select the
+=@{upstream}= option. When prompted for the branch, select
+=test/test-branch=.
+
+Then, put some text in the following example block, and commit the
+change ([[*Comitting][notes]]).
+
+#+BEGIN_EXAMPLE
+
+#+END_EXAMPLE
+
+Once you're done committing, return to the Magit status window, it
+should say you're ahead of the upstream branch by one commit.
+
+Press =P= and then =u= as before to push this new commit. As Git has
+remembered the upstream branch, you won't need to select it manually.
+
* Pulling
* Interactive rebasing