LinuxCommandLibrary

git

TLDR

Clone a repository

$ git clone [https://github.com/owner/repo.git]
copy
Stage and commit changes
$ git add . && git commit -m "[message]"
copy
Push to remote
$ git push origin [branch]
copy
Pull changes
$ git pull
copy
Create and switch branch
$ git checkout -b [branch-name]
copy

SYNOPSIS

git [options] command [args]

DESCRIPTION

git is a distributed version control system for tracking changes in source code. It enables collaboration through branching, merging, and remote repositories while maintaining complete history.
Git's distributed nature means every clone contains full history. Branches are lightweight, enabling feature development workflows. The staging area provides fine-grained commit control.
git is the dominant version control system for software development worldwide.

PARAMETERS

clone URL

Clone a repository.
add FILES
Stage files for commit.
commit
Record changes to repository.
push
Push to remote repository.
pull
Fetch and merge from remote.
checkout
Switch branches or restore files.
branch
List, create, or delete branches.
merge
Merge branches.
status
Show working tree status.
log
Show commit history.
--help
Display help information.

CAVEATS

Learning curve for advanced features. Large binary files need git-lfs. History rewriting affects collaborators.

HISTORY

Git was created by Linus Torvalds in 2005 for Linux kernel development after BitKeeper licensing issues. It has become the standard version control system for most software projects.

SEE ALSO

gh(1), git-commit(1), git-push(1)

Copied to clipboard