Skip to content
Snippets Groups Projects
Commit 551454fb authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

slides of essential commands and branches

parent f2bc881d
No related branches found
No related tags found
No related merge requests found
......@@ -69,27 +69,26 @@ $ git checkout develop
## Create your own version
Assume that you want to work on a function for multiplying 2 numbers.
Assume that you want to work on a function for adding 2 numbers.
<div class="fragment">
<br>
<font color="red">Create a new **branch**!</font>
```bash
$ git checkout -b multiply-2-numbers
# creates the branch locally
$ git checkout -b add-2-numbers
```
The `-b` flag creates the branch.
Locally, you have your own version now:
<img src="img/branch-create.png" class="branch-create" />
Push the branch to the remote repository
Push your version to your fork:
```bash
$ git push origin multiply-2-numbers
$ git push origin add-2-numbers
```
<br>
You can use the 5 essential commands as before.
Only difference: you are on your own branch.
<img src="img/branch-commit.png" class="branch-commit" />
<br><br>
(Live Demo)
......@@ -9,11 +9,11 @@
<br>
or in other words (remember these!):
```bash
$ git pull
$ git pull <remote> <branch>
$ git status
$ git add myFile.txt # example
$ git commit -m "myMessage" # example
$ git push
$ git push <remote> <branch>
```
......@@ -21,21 +21,25 @@ $ git push
Then, pull the latest revision:
```bash
$ git pull
$ git pull origin add-2-numbers
# Already up to date
```
<div class="fragment">
<br>
Verify its `status` with:
```bash
$ git status
```
## Modify a file
Modify and rename `addTwoNumbers.m` in the folder `src/firstCommit` as `addTwoNumbers_myName`:
```bash
$ mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m
$ cd src/firstCommit
$ mv addTwoNumbers.m addTwoNumbers_myName.m
```
<br>
......
img/branch-create.png

56.2 KiB | W: | H:

img/branch-create.png

108 KiB | W: | H:

img/branch-create.png
img/branch-create.png
img/branch-create.png
img/branch-create.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment