Skip to content

orianac/git_training

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git_training

Getting Start With Git

Introduction To Git Presentation

The best way learn git is to use it. If you've never used git before, I recommend beginning with this short, interactive tutorial: Try Git

Now that you have some idea of what the commands are and the basic workflow, let's do some real world examples.

First some setup

Local Configuration

There are alot of configuration options in git. The basics are listed below but you'll find you probably want to add more.
-- Link to Configuration Options

git config --global user.name my name”
git config --global user.email “my_email@hydro.washington.edu”

Setup a Github Account

Github is a hosting service for git repositories. Even if you don't use github as your standard remote, I recommend setting up an account. Sign Up For Github

If you are a student, you are likely eligible for a free "Micro Plan". This gives you five private repositories for 2 years. Apply here.

Practice

Our practice will follow the Github Bootcamp, with a few modifications.

  1. Setup Git

    If you are using your hydro computer, git is already installed (/usr/bin/git) and we've already taken care of the basic configuration, so you can skip to #2. If you are on another machine, installation is pretty easy and is outlined in the link above.

  2. Create A Repo

    Everyone needs a "Hello-World" repository. Follow the steps in the Create A Repo tutorial to create your own "Hello-World".

    If you are having trouble pushing to your github repository check to make sure you are pushing to the ssh address, rather than https address. You will likely need to setup your ssh key here.
    Once you have your ssh keys setup, try pushing to the ssh repo address git@github.com:$USER/hello-world.git

    You can change the remote address using: git remote set-url origin git@github.com:$USER/hello-world.git

    Bonus: Now that you have that dialed, try repeating those steps for a project you've been working on.

  3. Fork A Repo

    Follow the steps in the tutorial to fork and clone the Spoon-Knife repo.

    ####The assignment

    a. Fork the git_traning, VIC, and DHSVM repositories.

    b. Now clone the your fork of the git_training repository to your local machine. i.e.:

       git clone git@github.com:$USER/git_training.git
    
    *Note: If you get an ssh error when you try to clone or fetch, check out Github's tutorial on [how to setup ssh keys](https://help.github.com/articles/generating-ssh-keys).*
    

    c. Create a branch your local copy of the repo, something like

       git branch joes-example-branch
    

    d. Checkout your branch

       git checkout joes-example-branch
    

    Note: c and d can be done as a single step as

       git checkout -b joes-example-branch
    

    e. Add a file to your repo (i.e. my_new_file.txt). The commands you'll need for this are:

     touch my_new_file.txt
     git add
     git commit # Don't for get a good commit message
    

    f. Push your changes to your Github fork.

     git push origin joes-example-branch
    

    e. Submit a pull request to UW-Hydro. This is done from your Github Repository Page.

  4. Be Social

    Not mandatory but you can follow an organization (i.e. UW-Hydro) or a person (i.e. Joe Hamman if you want to stay tuned to ongoing developments on github

  5. GitHub Glossary

References and Links:

  • git-scm - Git's home page
  • Github - Github home page
  • Git-Flow - This is the branching model and workflow that VIC and DHSVM and a good way to think about how branching can help you work more efficiently.

About

A mostly empty git repository for git training

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published