Difference between revisions of "Git"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(→‎Online Books: Chapter 2)
(reorganized; subpages for many commands)
Line 7: Line 7:
 
==About==
 
==About==
 
[[Git]] is a [[version control system]] based on a powerful distributed model.{{seed}}
 
[[Git]] is a [[version control system]] based on a powerful distributed model.{{seed}}
===Commands===
+
==Commands==
* '''git config --global {{arg|param_name}} {{arg|param_value}}'''
+
{|
** '''param_name''': user.name, user.email, core.editor
+
|-
* '''git config --list'''
+
! alphabetical !! by function
** ''lists current configuration parameters''
+
|-
* '''git config {{arg|param_name}}'''
+
| valign=top |
** ''lists the current value for the given parameter
+
* '''[[/add|git add]]''' updates the index using content found in the working tree (can be specified), to prepare the content staged for the next commit
* '''[https://www.kernel.org/pub/software/scm/git/docs/git-add.html git add]'''
+
* '''[[/clone|git clone]]''' copies a repository from somewhere else
** ''updates the index using the current content found in the working tree, to prepare the content staged for the next commit''
+
* '''[[/commit|git commit]]''' commits changes currently staged
* '''[http://www.kernel.org/pub/software/scm/git/docs/git-reset.html git reset]'''
+
* '''[[/config|git config]]'''
** ''resets current HEAD to the specified state''
+
* '''[[/diff|git diff]]''' shows difference between current directory contents and what you have staged
* '''[http://kernel.org/pub/software/scm/git/docs/git-fetch.html git fetch]'''
+
* '''[[/fetch|git fetch]]''' fetches named heads or tags from one or more other repositories, along with the objects necessary to complete them.
** ''fetches named heads or tags from one or more other repositories, along with the objects necessary to complete them.''
+
* '''[[/init|git init]]''' initializes a new repository; does not add anything
* '''[http://kernel.org/pub/software/scm/git/docs/git-push.html git push]'''
+
* '''[[/merge|git merge]]'''
** ''updates remote refs using local refs, while sending objects necessary to complete the given refs''
+
* '''[[/pull|git 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.
* '''[https://www.kernel.org/pub/software/scm/git/docs/git-pull.html git pull]'''
+
* '''[[/push|git push]]''' updates remote refs using local refs, while sending objects necessary to complete the given refs
** ''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.''
+
* '''[[/reset|git reset]]''' resets current HEAD to the specified state
* '''[http://kernel.org/pub/software/scm/git/docs/git-stash.html git stash]'''
+
* '''[[/rm|git rm]]''' removes files from staging '''and also from the directory'''
** ''saves your local modifications away and reverts the working directory to match the HEAD commit''
+
* '''[[/stash|git stash]]''' saves local modifications, reverts the working directory to match HEAD commit
 +
* '''[[/status|git status]]''' shows status of current repository
 +
| valign=top |
 +
===initialization===
 +
* '''[[/config|git config]] --global {{arg|param_name}} {{arg|param_value}}'''
 +
===creating from scratch===
 +
* '''[[/init|git init]]''' initializes a new repository; does not add anything
 +
* '''[[/add|git add]]''' updates the index using content found in the working tree (can be specified), to prepare the content staged for the next commit
 +
* '''[[/rm|git rm]]''' removes files from staging '''and also from the directory'''
 +
* '''[[/status|git status]]''' shows status of current repository
 +
* '''[[/diff|git diff]]''' shows difference between current directory contents and what you have staged
 +
* '''[[/commit|git commit]]''' commits changes currently staged
 +
===copying from elsewhere===
 +
* '''[[/clone|git clone]]''' copies a repository from somewhere else
 +
|}
 
===Software===
 
===Software===
 
* [[git-cola]]: git GUI client
 
* [[git-cola]]: git GUI client

Revision as of 21:47, 9 December 2014

About

Git is a version control system based on a powerful distributed model.

This page is a seed article. You can help HTYP water it: make a request to expand a given page and/or donate to help give us more writing-hours!

Commands

alphabetical by function
  • git add updates the index using content found in the working tree (can be specified), to prepare the content staged for the next commit
  • git clone copies a repository from somewhere else
  • git commit commits changes currently staged
  • git config
  • git diff shows difference between current directory contents and what you have staged
  • git fetch fetches named heads or tags from one or more other repositories, along with the objects necessary to complete them.
  • git init initializes a new repository; does not add anything
  • git merge
  • git 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.
  • git push updates remote refs using local refs, while sending objects necessary to complete the given refs
  • git reset resets current HEAD to the specified state
  • git rm removes files from staging and also from the directory
  • git stash saves local modifications, reverts the working directory to match HEAD commit
  • git status shows status of current repository

initialization

creating from scratch

  • git init initializes a new repository; does not add anything
  • git add updates the index using content found in the working tree (can be specified), to prepare the content staged for the next commit
  • git rm removes files from staging and also from the directory
  • git status shows status of current repository
  • git diff shows difference between current directory contents and what you have staged
  • git commit commits changes currently staged

copying from elsewhere

  • git clone copies a repository from somewhere else

Software

Services

  • GitHub: free web-based git repository for open-source projects

Links

Reference

Online Books

Online Courses

Discussion