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
(using sortable table to reduce redundancy)
Line 5: Line 5:
 
[[license::open source]]
 
[[license::open source]]
 
</hide>
 
</hide>
 +
__NOTOC__
 
==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}}
Line 13: Line 14:
  
 
==Commands==
 
==Commands==
{|
+
{| class="wikitable sortable"
 
|-
 
|-
! alphabetical !! by function
+
! command || process || description
 
|-
 
|-
| valign=top |
+
| '''[[/add|git add]]'''             || repo creation 2 || updates the "staged" area using content found in the working tree (can be specified)
* '''[[/add|git add]]''' updates the "staged" area using content found in the working tree (can be specified)
+
|-
* '''[[/branch|git branch]]''' manages {{l/sub|branch}}es
+
| '''[[/branch|git branch]]'''       ||                || manages {{l/sub|branch}}es
* '''[[/checkout|git checkout]]'''  
+
|-
* '''[[/clone|git clone]]''' copies a repository from somewhere else
+
| '''[[/checkout|git checkout]]'''  
* '''[[/commit|git commit]]''' commits changes currently staged
+
|-
* '''[[/commit-tree|git commit-tree]]
+
| '''[[/clone|git clone]]'''         || repo creation 1b || copies a repository from somewhere else
* '''[[/config|git config]]'''
+
|-
* '''[[/diff|git diff]]''' shows difference between current directory contents and what you have staged
+
| '''[[/commit|git commit]]'''       || repo creation 6 || commits changes currently staged
* '''[[/fetch|git fetch]]''' 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
+
| '''[[/commit-tree|git commit-tree]]
* '''[[/log|git log]]''' returns information about {{l/sub|commit}}s
+
|-
* '''[[/merge|git merge]]''' joins two or more {{l/sub|branch}}es together
+
| '''[[/config|git config]]'''       || usage config    ||
* '''[[/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.
+
|-
* '''[[/push|git push]]''' updates remote refs using local refs, while sending objects necessary to complete the given refs
+
| '''[[/diff|git diff]]'''           || repo creation 5 || shows difference between current directory contents and what you have staged
* '''[[/rebase|git rebase]]''' forward-port local commits to the updated upstream head
+
|-
* '''[[/read-tree|git read-tree]]
+
| '''[[/fetch|git fetch]]'''         ||                || fetches named heads or tags from one or more other repositories, along with the objects necessary to complete them.
* '''[[/remote|git remote]]''' manage aliases for remote repositories
+
|-
* '''[[/reset|git reset]]''' resets current HEAD to the specified state
+
| '''[[/init|git init]]'''           || repo creation 1a || initializes a new repository; does not add anything
* '''[[/rm|git rm]]''' removes files from staging '''and by default also from the filesystem'''
+
|-
* '''[[/show|git show]]'''
+
| '''[[/log|git log]]'''             ||                || returns information about {{l/sub|commit}}s
* '''[[/stash|git stash]]''' saves local modifications, reverts the working directory to match HEAD commit
+
|-
* '''[[/status|git status]]''' shows status of current repository
+
| '''[[/merge|git merge]]'''         ||                || joins two or more {{l/sub|branch}}es together
* '''[[/submodule|git submodule]]''' manages {{l/sub|modules}}
+
|-
* '''[[/tag|git tag]]''' creates an alias for a particular revision
+
| '''[[/pull|git pull]]'''           || copying from    || 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.
* '''[[/worktree|git worktree]]
+
|-
* '''[[/write-tree|git write-tree]]
+
| '''[[/push|git push]]'''           || copying to      || updates remote refs using local refs, while sending objects necessary to complete the given refs
| valign=top |
+
|-
===initialization===
+
| '''[[/rebase|git rebase]]'''       ||                || forward-port local commits to the updated upstream head
* '''[[/config|git config]] --global {{arg|param_name}} {{arg|param_value}}'''
+
|-
===creating from scratch===
+
| '''[[/read-tree|git read-tree]]
* '''[[/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
+
| '''[[/remote|git remote]]'''       || copying      || manage aliases for remote repositories
* '''[[/rm|git rm]]''' removes files from staging '''and by default also from the filesystem'''
+
|-
* '''[[/status|git status]]''' shows status of current repository
+
| '''[[/reset|git reset]]'''         ||                || resets current HEAD to the specified state
* '''[[/diff|git diff]]''' shows difference between current directory contents and what you have staged
+
|-
* '''[[/commit|git commit]]''' commits changes currently staged
+
| '''[[/rm|git rm]]'''               || repo creation 3 || removes files from staging '''and by default also from the filesystem'''
===copying to elsewhere===
+
|-
* '''[[/remote|git remote]] add'''
+
| '''[[/show|git show]]'''
* '''[[/push|git push]]'''
+
|-
===copying from elsewhere===
+
| '''[[/stash|git stash]]'''         ||                || saves local modifications, reverts the working directory to match HEAD commit
* '''[[/clone|git clone]]''' copies a repository from somewhere else
+
|-
 +
| '''[[/status|git status]]'''       || repo creation 4 || shows status of current repository
 +
|-
 +
| '''[[/submodule|git submodule]]''' ||                || manages {{l/sub|modules}}
 +
|-
 +
| '''[[/tag|git tag]]'''             ||                || creates an alias for a particular revision
 +
|-
 +
| '''[[/worktree|git worktree]]
 +
|-
 +
| '''[[/write-tree|git write-tree]]
 
|}
 
|}
 
===Files===
 
===Files===

Revision as of 14:46, 16 November 2022


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!

Concepts

Commands

command process description
git add repo creation 2 updates the "staged" area using content found in the working tree (can be specified)
git branch manages branches
git checkout
git clone repo creation 1b copies a repository from somewhere else
git commit repo creation 6 commits changes currently staged
git commit-tree
git config usage config
git diff repo creation 5 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 repo creation 1a initializes a new repository; does not add anything
git log returns information about commits
git merge joins two or more branches together
git pull copying from 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 copying to updates remote refs using local refs, while sending objects necessary to complete the given refs
git rebase forward-port local commits to the updated upstream head
git read-tree
git remote copying manage aliases for remote repositories
git reset resets current HEAD to the specified state
git rm repo creation 3 removes files from staging and by default also from the filesystem
git show
git stash saves local modifications, reverts the working directory to match HEAD commit
git status repo creation 4 shows status of current repository
git submodule manages modules
git tag creates an alias for a particular revision
git worktree
git write-tree

Files

Software

Services

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

Error Messages

  • Error Code 403 fatal: HTTP request failed may indicate a bad password. I've found that sometimes the password either doesn't paste properly or else isn't being accepted the first time; trying again with the same password may work. (The password is not displayed, so I'm not sure which it is.)

Links

Reference

How To

Online Books

Online Courses

Articles

Discussion