├── Sample_Readme.md └── README.md /Sample_Readme.md: -------------------------------------------------------------------------------- 1 | Project 2 | ================= 3 | Here is where a brief description of the project should go. 4 | 5 | It may be worthwhile to list major project contributors here, especially if this is a closed source project as one might need to reach out for questions later on. 6 | 7 | Setting Up 8 | ================= 9 | Explain any specific project dependancies here. 10 | 11 | 12 | Deploying 13 | ================= 14 | Explain how to deploy this project. Maybe minimum computer specifications or browser requirements are listed here as well. 15 | 16 | Version History 17 | ================= 18 | #### 0.0.1 19 | - This is an update to the version history. 20 | - Version history should be thoroughly updated and correspond to project tags. 21 | 22 | #### 0.0.0 23 | - This is the first piece of version information. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Getting Started With Git and GitHub 2 | =================================== 3 | 4 | Explaining Git and GitHub. Forked from [Jaime Kosoy](https://github.com/jkosoy). The following commands below are to be run in the Terminal.App for Mac OSX or Linux. For a good overview on how to use the Terminal see [this tutorial](http://cli.learncodethehardway.org/book/). There is also a [desktop application](desktop application) for GitHub if you'd prefer to not use the Terminal.App. 5 | 6 | ## Some links for more in depth learning 7 | ### Hands on / interactive learning 8 | * [Learn Version Control with Git](https://www.git-tower.com/learn/ebook) A website for learning Git. Appears to cost money but has a free html book. 9 | * [Git Immersion](http://gitimmersion.com/lab_01.html) A website with tutorial materials you download and follow along with. 10 | * [Try Git](http://try.github.io/levels/1/challenges/1) A 15 minute interactive tutorial to learn the basics. 11 | * [Git-it](http://nodeschool.io/#git-it) Interactive software you run from the Terminal (requires installing node.js and nmp). 12 | 13 | ### Purely text based resources 14 | * [Git: No Deep Sh*t](http://rogerdudler.github.io/git-guide/) A super simplified way of explaining git, basically a cheatsheet. 15 | * [The Git Book](http://git-scm.com/book) Explains everything that's possible with git in lots and lots of detail. 16 | 17 | 18 | The Git Flow 19 | ================== 20 | 21 | The following snippet is designed to explain Vincent Driessen's [git branching model](http://nvie.com/posts/a-successful-git-branching-model/), at least as well as I understand it. Special thanks to [Stephen Koch](https://twitter.com/skoch) for being the true master here. 22 | 23 | A way to think about Git and Github. 24 | ------------ 25 | Milestones of milestones of milestones. In other words: 26 | 27 | - Open up a text editor. 28 | - Type "Hello World". 29 | - Save this file. 30 | - You have now created a "milestone" on your hard drive of this text. 31 | - You can now retreive that milestone by double clicking it to re-open it in your text editor. 32 | - This should be a concept you already understand quite well. 33 | - Change the contents of that file again. Add in your own text. Save it again. 34 | - By saving it again you've overwritten the previous milestone. 35 | - You can certainly redo the work (e.g. replacing all the text with "Hello World" and saving again) but the original work is gone otherwise. 36 | - Git saves milestones of milestones. 37 | 38 | git commit -am "By typing this command I am saving a collection of saved files." 39 | 40 | - This is great because now we can roll back to old versions of files without having to retype. Aka "source control". 41 | - However, wouldn't it be great if we could further save milestones in the cloud? 42 | - Aka milestones of milestones of milestones. 43 | - Github -> Git -> Save 44 | - Github is two things: 45 | - git, in the cloud 46 | - a social network around source code 47 | - All you need to do to push to Github: 48 | 49 | git push origin master 50 | 51 | - Now one could "clone" that repository on another computer and not just get the latest code but the complete revision history on another computer. 52 | 53 | 54 | 55 | Setting up 56 | ------------ 57 | Assuming your project is in a folder named "Project" on your Desktop. 58 | 59 | ### Starting from scratch 60 | cd ~/Desktop/Project 61 | git init 62 | git checkout -b develop 63 | touch README.md 64 | 65 | - Open the README.md file you just created in your text editor. Describe your project. I've provided a basic template below for what it's worth. Save it. 66 | - Go to Github (or Bitbucket or whereever you want to save your code in the cloud). Create a new project. 67 | - If you're on Github, ***do not check*** Initialize this project with a README since you just made one. 68 | - Determine your SSH clone url. On Github it's probably something like ***git@github.com:USERNAME/PROJECT.git***. Should be on the project's page somewhere. 69 | - Add your remote. 70 | 71 | git remote add origin {{the link you just copied}} 72 | 73 | - Breaking that down 74 | - git :: The git command 75 | - remote add :: We're adding a remote connection for this repository 76 | - origin :: We're naming the remote "origin". You can also call this "github" or "bananasauraus" if you'd like. 77 | 78 | 79 | ### Cloning an existing repository. 80 | 81 | - Determine your SSH clone url. On Github it's probably something like ***git@github.com:USERNAME/PROJECT.git***. Should be on the project's page somewhere. 82 | 83 | cd ~/Desktop 84 | git clone {{the link you just copied}} Project 85 | 86 | - This creates a directory named "Project", clones the repository there and adds a remote named "origin" back to the source. 87 | 88 | cd Project 89 | git checkout develop 90 | 91 | - If that last command fails 92 | 93 | git checkout -b develop 94 | 95 | Updating/The Development Cycle 96 | ------------ 97 | You now have a git repository, likely with two branches: master and develop. Now bake these laws into your mind and process: 98 | 99 | ####You will never commit to ***master*** directly. 100 | ####You will never commit to ***develop*** directly. 101 | 102 | Instead, you will create ***feature branches*** on your machine that exist for the purpose of solving singular issues. You will always base your features off the develop branch. 103 | 104 | git checkout develop 105 | git checkout -b my-feature-branch 106 | 107 | This last command creates a new branch named "my-feature-branch" based off of develop. You can name that branch whatever you like. You should not have to push it to Github unless you intend to work on multiple machines on that feature. 108 | 109 | Make changes. 110 | 111 | git add . 112 | git commit -am "I have made some changes." 113 | 114 | This adds any new files to be tracked and makes a commit. Now let's add them to develop. 115 | 116 | git checkout develop 117 | git merge --no-ff my-feature-branch 118 | git push origin develop 119 | 120 | Releasing 121 | ------------ 122 | Finished with your project? 123 | 124 | - Create a feature branch as normal. 125 | - Update the version history in the README.md file 126 | - Update this to develop as normal. 127 | 128 | git checkout master 129 | git merge --no-ff develop 130 | git push origin master 131 | git tag v1.0.0 132 | git push origin v1.0.0 133 | 134 | Replace 1.0.0 in the snippet here with your appropriate versions. Now you have a tag saved. --------------------------------------------------------------------------------