Skip to content

Commit

Permalink
Merge pull request #19 from orderedlist/add-version-control-document
Browse files Browse the repository at this point in the history
Add version control document
  • Loading branch information
orderedlist committed Jul 7, 2014
2 parents 9ae40f1 + ddb3b91 commit a9686a6
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions documents/VersionControl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
### Clone a repo

```bash
$ git clone https://github.com/your-username/scipy-tutorial-2014.git
```

### Branches

To create a branch

```bash
$ git checkout -b my-working-branch
```

Remember that this creates a branch *from* whatever branch is currently checked out. It's typically best to branch from master only, unless there's a reason to branch from an existing branch.

### Creating a Commit

```bash
git add -u # stages all changed files, including deleted files
git commit -m "Briefly describe your changes" # Try for 50 characters or less
```

### See your changes

```bash
$ git log master..
$ git diff master...
```

### Pushing your Branch

```bash
$ git push origin my-working-branch
```

When you're ready, create a pull request on GitHub to merge your work.

### Seeing changes in master

If your pull request was not from a fork, the changes you made will be available on the master branch.

```bash
$ git pull origin master
$ git log master
$ git log master --first-parent
```

### Working with Forks

If your pull request was from a fork, you'll need to pull changes from the upstream repository to get your changes in master.

```bash
$ git remote -v # list remotes
$ git remote add upstream https://github.com/reproducible-research/scipy-tutorial-2014
$ git remote -v # should now see your new upstream remote
```

To update your fork from the upstream

```bash
$ git fetch upstream
$ git rebase upstream/master
```

Then, to get those changes back up into your fork on GitHub

```bash
$ git push origin master
```

### Resources

* https://guides.github.com/introduction/flow/
* https://github.com/jnunemaker/dotfiles/blob/master/bash/config
* https://github.com/jnunemaker/dotfiles/blob/master/bash/git-completion
* https://guides.github.com/activities/citable-code/

0 comments on commit a9686a6

Please sign in to comment.