# Resolving merge conflicts https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ +------------------------------------------------------------------------------+ | REMINDERS | +------------------------------------------------------------------------------+ # Definitions: # working directory : the directory that work takes place in, # typically this is staged and then committed. # # repo : the store of historical data # about the project, including versions # of the project # # staged files : files listed to go in next commit # # origin : name of upstream remote repo # # master : name of main branch of development git clone URL git pull # pull the latest history for this branch from the remote (origin) # and merge with the latest commit. Checkout latest # commits on this branch. Should do this on a clean # workspace, otherwise things get complicated. git merge BRANCH # merge BRANCH into this branch, if all goes well # this includes an add and commit. If not, you have to # manually make appropriate changes, add and commit. # You still need to push to make upstream aware. # change files git add --all . git commit -m 'commit message' git push git checkout # How do I undo all my local changes git reset --hard # put tracked files back as they were git clean -fd # remove untracked files # misc branch related commands git branch NEW_BRANCH_NAME git checkout NEW_BRANCH_NAME git status git branch # show list of branches and one I'm currently on # Configure new branch (setting origin to track this branch) git push --set-upstream origin NEW_BRANCH_NAME # or git push -u # some git log commands git log git log --graph --abbrev-commit --decorate --date=relative --all +------------------------------------------------------------------------------+ | WORKFLOW | +------------------------------------------------------------------------------+ # Grab a user story # Make sure your working directory is clean # the result of a latest commit and push git pull # latest version of the repo git branch NEW_BRANCH # branch off the latest version of working code from the remote git checkout NEW_BRANCH # could have also added a flag above # modify files (work done on userstory) git add --all . git commit -m 'COMMIT_MESSAGE' git push --set-upstream origin NEW_BRANCH # modify files (work done on userstory) git add --all . git commit -m 'COMMIT_MESSAGE' git push # ... # Now work done on userstory, want to merge back to master git checkout master git pull # all latest development from master branch git merge NEW_BRANCH # resolve conflicts, if any then ... git add --all . git commit git push