Skip to content

neiloconnor/intro-to-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

intro-to-git

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.

The README file

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

Key concepts in Git

Versions

./diagrams/version_history.png

Repository

./diagrams/repos.png

Git commands

./diagrams/basic_commands.png

More information here and here

Setting up a new repository

  1. Create a repository on Github as described here
  2. Clone it to create a local copy of the files
git clone https://github.com/your-username/your-repository.git
  1. Set your authentication details for this repository. On your own computer you can use global settings, but in the labs you need to use local. This will allow you to commit changes
git config --local user.name "your name"
git config --local user.email "your email address"

Tracking changes to files

  1. View recent commits git log
  2. View the changes of a particular commit with git show and the ID of the commit
  3. Check what files have changed since last commit git status
  4. What are the changes in those files git diff
  5. Add changed files to staging with git add filename
  6. Create a new commit with these changes `git commit -m "This message describes the changes"'.

Sharing with the remote repository

  1. Get the latest changes from the remote repository git pull
  2. Push your local changes on a particular branch to the remote repository git push origin master

Collaboration workflow

  1. One common strategy is Gitflow
  2. master branch is the one that gets deployed to production
  3. A develop branch is created to hold peer-reviewed code waiting to be deployed
  4. New branches are created to work on particular features (called feature branches)
  5. Code in feature branches is peer reviewed in a pull request and merged into the develop branch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published