90 likes | 104 Views
How the heck do i use github & Command line?. Using Git with collaboration , code review, and code management for open source and private projects. & Using Terminal to create, and push commits to repositories hosted on Github. Benefits of using Github.
E N D
How the heck do i use github & Command line? • Using Git with collaboration, code review, and code management for open source and private projects. • & • Using Terminal to create, and push commits to repositories hosted on Github.
Benefits of using Github • GitHub is the largest code host on the planet with over 11.4 million repositories • Integrated issue tracking via Pull Requests • Collaborative code review • Create Teams & Organizations • Receive and give contributions to projects • Track your progress and projects you've worked on
Benefits of using Command Line vs Git GUI • Git was written for command line • Using Git through an application is actually a hack • Git GUIs make git more difficult and complicated • Git terminal commands are simple. It doesn’t need an application, often times the applications will create weird commits, weird branches, and screw up your files. • It’s just faster from the command line.
Github Workflow • Create a Repository: • This is the master branch and should be working and ready to deploy at any time • Make a Branch: • Branches are created so that you have an environment to try out new things and make changes to your code without wrecking the master branch • Add Commits: • Whenever you add, edit, or delete a file, you're making a commit, and adding them to your branch. Commits help you keep track of your progress as you work on a branch.
Github Workflow • Open a Pull Request: • Pull Requests initiate discussion about your commits. Pull Requests also provide a way to notify project maintainers about the changes you'd like them to consider. • Discuss & Review your changes: • Once a Pull Request has been opened, the person or team reviewing your changes may have questions or comments. • Merge & Deploy: • Once your Pull Request has been reviewed and the branch passes your tests, it's time to merge your code to the master branch for deployment. Github automatically compares both branches to see if the branches are able to be merged.
Git Commands • git init - Initializes a git repository within the current directory you are in. • git status - Shows the current status of the project, displays what files have been changes and which files are staged and ready to be commited. • git add {index.html} - Adds the file to the staging area and git to start tracking the file and watch for changes. • git commit -m “this is a commit message” - Stores our staged changes with a message describing what was changed. • git log - Displays a log of all the commits we’ve made so far. • git remote add origin https://github.com/gituser/reponame.git - Connects the initialized repository to the remote repository located on github. • git push -u origin master -Tells git where in the repository to put our commits. • git pull origin master -Pulls down any new changes from the master repository to your local copy of the repository. • git clonehttps://github.com/gituser/reponame.git - Clones a local copy of a repository on github into a newly created directory, also initializes and begins watching the directory.
but just how easy is it? Lets see…
Useful Resources • http://try.github.io/- Awesome beginner github & command line tutorial made by Codeschool. • https://help.github.com/articles/set-up-git- A short guide by github on how to set up git. • https://help.github.com/articles/create-a-repo- Short guide by github on how to create and initialize a repository on github.
Questions: • What is the command to Initialize a git repository? Git init. • What is it called when you open an issue on a repository? Pull Request • What are 2 benefits of using command line over a git GUI? Its faster, simpler and more reliable. • What is the biggest draw to using github? Its collaborative.