Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 3.69 KB

1. Git And GitHub.md

File metadata and controls

39 lines (29 loc) · 3.69 KB

Good to know

Git and GitHub

Git is a distributed revision control and source code management (SCM) system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control system for software development. - From first paragraph in wikipedia article http://en.wikipedia.org/wiki/Git_(software)

There are two ways to use Git

The Basics

Below are some of the most basic commands to use and terms to understand when using git. Note that when using the command line that before each command comes: > git (Command here)

  • clone (repo): Clones the repo to a directory
  • add (filename): adds a file which will later be commited and then pushed. By adding we are just preparing for the push, not actually adding the file anywhere.
  • commit: Record changes to the repository. This commit the already added file. Nice shortcut using the commit command is: "commit -m (Commit message)" This commits all added files with the commit message
  • push: Pushes the commits to a repo
  • merge: Used when gits comes across a merge conflict. When you get a conflict, mergetool might save you a lot of time.
  • log: Logs to the screen the pushed commits. (Commit message, commit ID, commit time and more). Useful when you need revert to a specific commit
  • status: Show what file have been added, removed and modifed. Also shows the current branch and how many commits your branch is behind or ahead.
  • rm: Removes a file from git. USE WITH CARE
  • checkout (branchname): Switch to another branch. The command "checkout -b (branchname)" checks out branch if it exists, otherwise it creates a new branch with the given name
  • fetch: Imports commits from remote repositories to your local one. Can also be used to fetch specified branch. The fetch command can be used like "git fetch (remote)" example "$ git fetch https://github.com/reykjavik-university/2014-T-514-VEFT", branch can also be specified with the fetch command like this "git fetch (remote) (branch)".
  • pull: Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

#Documentation

#Tutorials