Codementor Events

Git QuickTip: a Workflow for Git On Teams

Published Oct 12, 2015Last updated Feb 10, 2017

This tutorial is pretty straightforward. It assumes you already have your project cloned from a master remote repository, and that your project already has an origin repository it is pointing to. As long as you have those things, do this daily. Keeping code "hoarded" tends to lead to more severe merge conflicts - so this should happen at least once a day for the project you are working on:

git commit -m "I'm doing awesome work" -a

If you don't want to commit everything you currently have working directory changes for:
git add (file name or directory to commit
git commit -m "Committing some of my work, but not all of it"
git stash (If you stash file changes here, you'll have to pull them back out of the stash in a few minutes)
git fetch
git rebase origin/(branchname)
Resolve any merge conflicts that happen
git add .
git rebase --continue
git push origin branchname

Optional: If you stashed some changes before, here use git stash apply to put them back into your working directory

Discover and read more posts from Jason Lowenthal
get started
post commentsBe the first to share your opinion
Show more replies