Tutorial on using git

After learning out the world of open source in the previous post let’s learn how to use Git which is used by GitHub for contributing to the world of open source.

Why git?

  • Better managing of a team project
  • Very easy to use
  • Makes it easy to develop for multiple tasks simultaneously
  • No use of copy pasting of projects/nor emailing this

What is Git? version control system for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files.

Interactive question

Which are the other VCS’s?

  • Subversion
  • Mercurial
  • CVS (Concurrent Versions System)

Basics of GIT

  • Staging area - https://git-scm.com/images/about/index1@2x.png
  • Commits -
  • Branches - https://media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAk3AAAAJDYwNzY5OTA1LTA1YmItNGRlOS1iODQ3LTYzZjRjOGFiZTIzNg.jpg

Basic commands on GIT

  • git init
  • git status
  • [ Make some changes ] git commit -m, -a
  • git push
  • git merge
  • git log git log —oneline

Local branches

New branch: git checkout -b new-branch

What is github?

  • Repositories
  • Collaborators
  • Forks

Remote branches

To list all branches: git remote -v To add: git remote add [URL]

How to create pull requests

Pulling branches

  • Difference between git pull & git fetch

What to do when you’re stuck or messed up the git setup

  • Use git reset
    • –soft
    • –hard
  • Use git reflog

Miscellaneous points on GIT

  • Theres no download/upload in git instead we push/pull or cloning repo
  • Github student pack - https://education.github.com/pack

Quick glance on some advance uses of github/git -

  • Continuous integration
  • Rebasing