Git - Help me understand and improve my two-man workflow -
a teammate , (both new git) working on new project. project still in stages of development, changes not @ point can broken well-isolated features.
this our current workflow. (i know it's wrong)...
git commit
git pull origin
git push origin
i'm having trouble understanding results in following scenario...
- i commited small change locally
- my teammate made series of commits , pushed origin
- i finished working on, commited again
- i pulled in changes, , pushed origin
afterwards, expected diff show changes, since that's what's new origin. instead, see teammates changes added code. in addition, teammate received errors when trying pull (did not record them, unfortunately), , had clone things working right again.
to make things expected in first place, (after searching around stackoverflow)...
git reset --hard
git checkout <teammates last commit>
git merge <my last commit>
git push
first, i'd understand happened. second, i'd know better approach going forward.
without more information on errors were, it's hard why occurred. may binary files modified (this causes git errors), lots of other things, too.
it sounds me git working correctly: last change did pull in teammate's changes, , that's reflected in recent git diff. want pull before doing commit, make sure you're working date version of repository. also, diff
command works on commit history; when pushed origin irrelevant.
in future, may want working branches. if each have own branch, can use git rebase
pull in changes have been made master branch before committing modifications. working local branches makes collaborating easier, because don't have worry committing changes aren't yet ready prime time master branch. nice tutorial on branching can found at: http://git-scm.com/book/en/git-branching-basic-branching-and-merging. i've found useful in past.
Comments
Post a Comment