This repository is an introduction to Git. Each of the sections describes some aspect of using Git, but if you're learning independently I suggest starting with this comprehensive tutorial.
Every repository should have a README file: it explains what the repository is for and how to use it. The README file is styled using Markdown
More information here and here
- Create a repository on Github as described here
- Clone it to create a local copy of the files
git clone https://github.com/your-username/your-repository.git
- Set your authentication details for this repository. On your own computer you can use
globalsettings, but in the labs you need to uselocal. This will allow you to commit changes
git config --local user.name "your name"
git config --local user.email "your email address"
- View recent commits
git log - View the changes of a particular commit with
git showand the ID of the commit - Check what files have changed since last commit
git status - What are the changes in those files
git diff - Add changed files to
stagingwithgit add filename - Create a new commit with these changes `git commit -m "This message describes the changes"'.
- Get the latest changes from the remote repository
git pull - Push your local changes on a particular branch to the remote repository
git push origin master
- One common strategy is Gitflow
masterbranch is the one that gets deployed to production- A
developbranch is created to hold peer-reviewed code waiting to be deployed - New branches are created to work on particular features (called feature branches)
- Code in feature branches is peer reviewed in a pull request and merged into the develop branch


