Agenda
- Bash prompt
- Gitflow
- Random python stuff
Git in your Prompt
A prerequisite, to be sure.
- First, run the following in your home directory:
$ wget http://threebean.org/bashrc-gitprompt
- Next, edit ~/.bashrc and add the following at the bottom:
# Pull in the fancy bash prompt for git stuff.
if [ -f $HOME/bashrc-gitprompt ]; then
,.... $HOME/bashrc-gitprompt
fi
- Close your terminal, re-open it, and try navigating to a git project
you have around.
What is gitflow
- Two things:
- Primarily -- a way to think about git branches and what to use them
for. Git is decentralized, and branches can quickly get out of hand.
That can scare people away from using them. But, technologically
they're cheap as f*ck and they can help save you lots of pain. The "git
flow" model attempts to help save you from the pain of not using branches
while mitigating the pain and confusing that too many or unorganized
branches can bring. It brings organization to the open-ended power of git
(which is maybe more wild than you might
have realized).
- A command line tool that makes using that model easier (maybe). Sweetly,
it installs itself as an extension to git. Usage looks something like
this:
- git flow init
- git flow feature start crazy-idea
- git flow feature finish crazy-idea
- git flow release start 1.9.0alpha
- git flow release finish 1.9.0alpha
- You can (and should) get all this information from the horse's mouth. Homeboy
nvie is a whole 'nuther kettle of fish.'
- I maintain the gitflow
package for Fedora and EPEL.
It looks something like this
Decentralized, but centralized
A tangent -- some fancies
The main branches
Setting up some git flow
- Run $ sudo yum -y install gitflow
- Create a new crap repo to try it out:
- $ mkdir -p ~/scratch/silly-repo
- $ cd ~/scratch/silly-repo/
- $ git init
- $ echo "This is some content" > this-is-a-file.txt
- $ git add this-is-a-file.txt
- $ git commit -m 'This is my first commit.'
- Ok.. that was git. You know that. Try $ git l to see the history.
- For some git flow, try this:
- $ git flow init # You only have to do this once
- Try that $ git l again. You have a "master" and "develop" branch now.
Feature branches
Try some feature branches
- $ git flow feature start i-have-an-idea
- Make some changes, commit.
- $ git flow feature start i-have-another-idea
- Make some changes, commit.
- Check the output with $ git l
- You can switch between branches with git checkout. Try:
- $ git checkout develop
- $ echo "watwat" > some_file.txt
- $ git add some_file.txt
- $ git commit -m 'Another commit'
- $ git l --all
- $ git flow feature finish i-have-an-idea
- $ git flow feature publish i-have-another-idea
Merging features
Merging features with GitHub
- $ git flow feature publish i-have-an-idea
- Open a pull request for review.
Hotfix branches
Questions on Git Flow?
Python Terminal Time
Time to switch topics entirely.