Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
git-it-together
meetings
Commits
5c2f9e91
Commit
5c2f9e91
authored
Dec 28, 2016
by
French, Robert
Browse files
Add slide page
parent
7b49484d
Changes
4
Hide whitespace changes
Inline
Side-by-side
branches-for-fun-and-profit/README.md
View file @
5c2f9e91
...
...
@@ -7,3 +7,5 @@ for branching are second to none. In this workshop we will cover:
*
branching as a means of organized brainstorming
*
syncing branches with gitlab
*
Simple merging of local branches
[
next
](
slide1.md
)
branches-for-fun-and-profit/slide1.md
0 → 100644
View file @
5c2f9e91
# Branches for Fun and Profit
## Organized Brainstorming
Branches allow you to organize your thoughts and make experimental changes in
an isolated environment. They also make it easy to throw bad ideas out the
window without tedious rewinding and backtracking.
### List current branches
```
bash
git branch
```
This shows the branches that are already available in your project. You should
usually have at least one branch called
`master`
that represents a working
copy of your program.
### Create a new branch (try a new idea)
```
bash
git checkout
-b
dandy-new-idea
```
Now we have a safe area where we can hack away on a new idea. If you want to
show some of this work to your colleagues, but are not yet ready to make it
part of your "production" application, you can push it to gitlab like so:
### Push to a remote branch
```
bash
git push
-u
origin dandy-new-idea
```
This tells git to make a new
*upstream*
branch that you plan to keep in sync
with your local
`dandy-new-idea`
branch.
### Merge good ideas into master
```
bash
git checkout master
git merge dandy-new-idea
```
Once you like your new code and
**all your existing tests pass**
, merging your
changes into the
`master`
branch signifies that your new work is good and ready
to be released into the wild (or at least, to be considered for release).
[
previous
](
README.md
)
|
[
next
](
slide2.md
)
branches-for-fun-and-profit/slide2.md
0 → 100644
View file @
5c2f9e91
# Branches for Fun and Profit
## Hacking the Inspirational Quote Generator
Let's practice some branching basics inside of a running project.
### Setup
Follow the setup instructions on the
[
Inspirational Quote Generator README
](
https://code.ornl.gov/git-it-together/inspirational-quote-generator
)
.
I suggest you fork a copy of the above repo to your own user page.
### Making changes
The default quotes are not very inspirational. Let's make some changes in a new
branch:
```
bash
git checkout
-b
increase-inspirationality-of-quotes
```
Now you are free to make whatever changes you would like!
### Committing Changes
First, let's make sure the tests still pass:
```
bash
./bin/test.sh
```
If so, we can commit our changes:
```
bash
git commit
-am
"Improving the motivational quality of quotes"
```
### Pushing changes to Gitlab
As we did earlier, if we want to get a second set of eyeballs on the quotes, we
can push them to gitlab as such:
```
bash
git push
-u
origin increase-inspirationality-of-quotes
```
### Merging into master
Once we are happy with the changes, we can merge them into master like this:
```
bash
git checkout master
git merge increase-inspirationality-of-quotes
```
[
previous
](
slide1.md
)
|
[
next
](
slide3.md
)
branches-for-fun-and-profit/slide3.md
0 → 100644
View file @
5c2f9e91
# Branches for Fun and Profit
## Cleaning up old branches
After we are done making changes, it is a good habit to clean up old branches
so that they no longer clutter our workspace
```
bash
git branch
-d
increase-inspirationality-of-quotes
```
Now if we list our branches, we will see that we are just left with
`master`
:
```
bash
git branch
```
[
previous
](
slide2.md
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment