I kinda get Git…

This past week at Epicodus (my software development bootcamp), we’ve been working on team projects and using git to keep our respective code implementations in sync. It has been a fabulous learning experience using git as part of a team, and I feel that I should share what we created as a workflow for our team. Because we are all beginners to the flow of git, we wrote our guidelines as simply as possible, trying to include every little step. I realize this does not even begin to cover all of the ways to use git, but it’s been enough for us at this point. I’m sure I’ll add to this as we move into other scenarios.   Until then, here’s you go:

A Simple Workflow for Git”

http://fur.ly/0/gitwork

1. If you are starting from scratch, create a repo in git, and copy repo filepath. If you have an existing remote repository, then you will clone it.

2. Type the following into your terminal:

git clone <repo_filepath> .

*** VERY IMPORTANT ***

2.5 Each person working on the project should start by typing the following into your terminal, to make sure you have the most recent version of the master repo. You always want to type this, every time you are starting a new branch:

“`

git pull origin master

“`

3. Create a new branch and switch to it in your terminal:

git checkout -b <branchname>

4. Work on your branch until you’re ready to commit. Then type the following into your terminal:

git add . (to add files)

git commit -m “Add..” (to commit changes).

5. After committing, you are ready to merge your branch to the master. First, switch to master in your terminal:

git checkout master

6. Now, to merge your branch to the master, type the following in your terminal:

git merge <branchname>

7. If there are conflicts to resolve, they will appear in a new file in your text editor.  These need to be resolved locally in your text editor before you commit your branch. Once these are resolved, **save and close the text editor** file and type the following in terminal:

git add .

git commit -m “Add..”

8. Then push from your local repo to the remote repository (GitHub), by typing the following into terminal:

git push origin master

9. Once this is done, delete your branch in terminal by typing:

git branch -d <branchname>

10. If you have your branch saved on the remote repo, then type the following into terminal. If you don’t have your branch saved in the remote repo, then DON’T type the following, and go to step 11.

git push origin –delete <branchname>

This is a complete workflow!  Yay

_____

One thought on “I kinda get Git…

  1. Pingback: What blog am I reading?!? | Twyste

Thanks for commenting!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s