Git


Branches and Merging

  1. git checkout -b new-branch or whatever your branch name is
  2. make your changes in development branch
  3. git add .
  4. git commit -m “developed feature x”
  5. git push origin new-branch
  6. when ready to merge, still on new-branch
  7. git merge master should be clean, but gives you an opportunity to fix it
  8. git checkout master should be clean again since we did above fix
  9. git merge new-branch --no-ff
  10. git push

Replace one branch with another

Useful if working on complete overhauls in a separate branch

git checkout better_branch
git merge --strategy=ours master 
git checkout master
git merge better_branch 

Multi line commit

git commit -m "Line one" -m "line two" -m "etc"

push to repo other than origin

git push --no-verify --mirror git@github.com:isuwebcom/Work

Change Origin

# useful for when repo is set to use https
git remote set-url origin git@github.com:kalenpw/repo.git