A Simple Git Workflow

We started our first group project in the Data Analysis and Visualization bootcamp. Coordinating a workflow for five inexperienced people using git and github was one of the first hurdles to jump. I was appointed the team’s “git master” since I had a tiny bit of experience using it before the bootcamp began. Combining my love for troubleshooting and technical writing, I came up with a simple set of instructions for my team and wanted to share it here.

Common console commands: 
cd - change directory
mkdir - make directory
ls - view the files/folders in directory

NOTE: Exit VIM if needed ctrl + c then type :qa! and push enter
NOTE: If file is not in local repo, manually move the file into
the correct folder (outside of console)

Managing your Local Repo
NOTE: If you need to hard reset your local repo to match
the remote master use the following commands:
$ git fetch origin
$ git reset --hard origin/master

Undo the act of committing, leaving everything else intact:
$ git reset --soft HEAD^:

Undo the act of committing and everything you'd staged,
but leave the work tree (your files intact):
$ git reset HEAD^

Completely undo it, throwing away all uncommitted changes,
resetting everything to the previous commit:
$ git reset --hard HEAD^

Clone the Repo to local machine:
$ git clone https://github.com/bendgame/Project-one.git

Make sure the local master is up-to-date:
$ git pull origin master

Create new branch:
$ git banch branch_name

Move to branch:
$ git checkout branch_name

Navigate file structure as needed:
$ ls
$ cd folder_name

Add the files to the branch:
$ git add .

Verify file:
$ git status

Commit the files:
$ git commit -m "comment"

Add branch and files to the Remote Repo:
$ git push -u origin branch_name

Go to the github website to manage pull request and merge.

Switch back to local master so you can delete the local branch:
$ git checkout master

Delete local branch:
$ git branch -d branch_name
$ git branch -D branch_name

If you don't want to go to the website, you can merge your branch
to the master locally and push the new master to the remote repo:

Switch back to master branch:
$ git checkout master

Merge the branch with the local master:
$ git merge branch_name -m "comment"

Push the local master to the remote master:
$ git push origin master

Delete local branch:
$ git branch -d branch_name
$ git branch -D branch_name

There you have it! Our simple git workflow used by five noobies to manage our first group project on github.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close