PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/README.md

https://bitbucket.org/lawrancej/compilers
Markdown | 136 lines | 78 code | 58 blank | 0 comment | 0 complexity | a1f8ef2145ea4a9d6dc76a7378676ce6 MD5 | raw file
  1. # Git, Bitbucket/Github setup
  2. ![Summary of Git, Bitbucket/Github setup](setup.gif)
  3. 1. [Download and install Git.](http://git-scm.com)
  4. (Also, [TortoiseGit on Windows.](http://code.google.com/p/tortoisegit/))
  5. During installation, always click *Next*, *Continue* or *Finish*, but in the Git install, be sure to first select **Run Git and included Unix tools from the Windows Command Prompt** when it is an option.
  6. 2. Configure Git.
  7. In Windows, open Git Bash: **Start -> All Programs -> Git -> Git Bash**. In Linux/Mac OSX, open **Terminal**.
  8. git config --global user.name "Joey Lawrance" # Use your name
  9. git config --global user.email lawrancej@wit.edu # Use your email
  10. 3. Create a [Bitbucket](http://bitbucket.org) or [Github](http://github.com) account. Use your *@wit.edu* email address.
  11. **Note:** Bitbucket will automatically give you private repositories necessary for submitting work. If you use Github, [you should first request private repositories](http://github.com/edu); otherwise, you can create a public repository now and make it private later once you get private repository access.
  12. 4. [Email me your user name and tell me which service you're using.](mailto:lawrancej@wit.edu)
  13. 5. **Optional** Set up your [Gravatar](http://en.gravatar.com/) with your *@wit.edu* email address (that way, people can associate your user name with your face).
  14. 6. **Optional** Set up SSH keys (that way, you won't need to type in your password when pushing repositories).
  15. Create a public/private keypair.
  16. ssh-keygen -t rsa # Just press enter until it's done
  17. Copy the public key to the clipboard.
  18. cat ~/.ssh/id_rsa.pub > /dev/clipboard # On Windows
  19. cat ~/.ssh/id_rsa.pub | pbcopy # On Mac OS X
  20. cat ~/.ssh/id_rsa.pub | xclip # On Linux
  21. Paste your public SSH key into the key field in Bitbucket or [Github](https://github.com/settings/ssh) (On Bitbucket, navigate to your user -> Manage account -> SSH keys). For the title, use a nickname for your machine.
  22. 7. Create a new **private** repository called **Compilers** on [Bitbucket](https://bitbucket.org/repo/create) or [Github](https://github.com/new).
  23. 8. Click on **Watch** (or the eye icon on Bitbucket) to automatically receive notification of course repository updates (I will not email the class every time add hints to assignments).
  24. 9. Clone the course repository. Please **do not fork.**
  25. git clone https://bitbucket.org/lawrancej/compilers.git
  26. - or -
  27. git clone https://github.com/lawrancej/Compilers.git
  28. When you press enter, you should see something like this:
  29. Cloning into 'compilers'...
  30. remote: Counting objects: 12, done.
  31. remote: Compressing objects: 100% (10/10), done.
  32. remote: Total 12 (delta 1), reused 0 (delta 0)
  33. Unpacking objects: 100% (12/12), done.
  34. 10. Go into the repository you just cloned.
  35. cd compilers
  36. 11. Connect your local repository to your private repository.
  37. Copy the HTTPS *.git* repository URL from Bitbucket or Github. (To use SSH repository URLs, set up SSH keys first.)
  38. git remote -v
  39. git remote add me url.to.private.repo.goes.here.git
  40. git push -u me master
  41. 12. Reload your private repository on Bitbucket or Github to verify everything pushed over properly.
  42. 13. Add me as a collaborator to your private repository (otherwise, I can't see what you submit).
  43. On Bitbucket, go to your private repository, click the gear icon, and select **Access management**. Enter `lawrancej` under Users and select **Admin**. Click Add.
  44. On Github, go to your private repository, click **Settings**, click **Collaborators**. Enter `lawrancej`. Click Add.
  45. # Work submission
  46. 1. Check the status of your repository.
  47. git status
  48. **Untracked files** are not in version control.
  49. **Changes not staged for commit** are revisions that are not yet recorded into a commit.
  50. **Changes to be committed** are staged, but not yet recorded into a commit.
  51. 2. Review your changes.
  52. git diff
  53. Use this information to decide how to proceed.
  54. 3. Add files to git as necessary.
  55. git add new.file.here another.file.here
  56. 4. Record your changes into a commit.
  57. git commit -m "Completed lab 1."
  58. 5. When you are ready to submit work, push it to your private repository.
  59. git push me master
  60. # Get new course material
  61. I will post new material frequently. Pull (fetch and merge) to receive updates.
  62. git pull origin master
  63. Occasionally, this command won't work because we made conflicting changes. To fix a merge conflict, look for conflict markers and revise as necessary. This command makes it easier:
  64. git mergetool
  65. If you want to keep only my changes, checkout their version.
  66. git checkout --theirs some.file.goes.here
  67. If you want to keep only your changes, checkout our version.
  68. git checkout --ours some.file.goes.here
  69. If you are thoroughly confused, examine the complete history to see what's going on.
  70. gitk --all &
  71. **Note:** Even though you have removed conflict markers, you must still add files to git and commit as usual to resolve the merge conflict.
  72. # References
  73. * [Atlassian Git Tutorials](http://www.atlassian.com/git/)
  74. * [Pro Git](http://git-scm.com/book)
  75. * [Git Reference](http://gitref.org/)
  76. * [Git Immersion](http://gitimmersion.com/)
  77. * [Try Git](http://try.github.com/)
  78. * [Git Branching](http://pcottle.github.io/learnGitBranching/?demo)