Pro Yearly is on sale from $80 to $50! »

Advanced Git - Paul Grayson

B044a0f039af800f4df09bf3b2465f18?s=47 Las Vegas Ruby Group
August 14, 2013
60

Advanced Git - Paul Grayson

B044a0f039af800f4df09bf3b2465f18?s=128

Las Vegas Ruby Group

August 14, 2013
Tweet

Transcript

  1. Advanced Git: Multiple Branches and Servers Paul Grayson 2013-08-14

  2. Simple Git • One server: “origin” • One branch: “master”

  3. Demo: make a commit and push

  4. Goal Use Git with multiple branches and servers, and know

    what is going on.
  5. What is a branch? A label for a state of

    the repository - Current files (the commit) and all history. • List: git branch [-a] • Create: git branch <name> • Read: git show-branch, git log • Update: git commit • Delete: git branch -d <name>
  6. Structure of Git history branch1 master

  7. History of branch1 branch1 master

  8. History of master branch1 master

  9. branch1 --not master branch1 master

  10. master --not branch1 branch1 master

  11. Merging: the main point of branches branch1 master merge base

  12. Checking changes on a branch • git log A --not

    B • gitk A --not B • git merge-base A B • git log -1 commit • git log --oneline --graph • git diff A B
  13. Multiple servers • Repositories on servers are called remotes -

    but so are some other things, watch out! • Look at .git/config • git fetch server • git push server A:B
  14. Git history with remotes branch1 master server/master origin/master

  15. Git history with remotes branch1 master server/master origin/master LOCAL CACHED

    COPIES!!!!
  16. Checking remote branches git fetch Then use same techniques as

    for branches • git log remote/A --not remote/B • gitk remote/A --not remote/B • git show-branch --merge-base ... • git log -1 commit • git log --oneline --graph • git diff remote/A remote/B
  17. Putting it together: simple two-server workflow origin - code archive

    server - production git showchanges branch1 git merge branch1 git push origin master git push origin :branch1 git push server master (on server) git merge master
  18. Final touch: make it like Heroku using post-receive #!/bin/sh unset

    GIT_DIR cd .. exec git merge master --ff