Skip to main content

GitDocs

Introduction

GitDocs is an open-source, Git-based platform designed for easy and seamless creation, management, and versioning of documentation. It is designed to allow users to manage documentation just like code, leveraging Git repositories for version control. This enables teams and developers to collaborate on documents efficiently, track changes over time, and maintain high-quality documentation alongside their source code.

With GitDocs, users can:

Create and manage rich text documents. Version documentation alongside their software code using Git. Utilize Markdown for easy formatting and integration with codebases. Collaborate with team members, track changes, and manage documentation histories.

Git MERGING Commands

NAME

git-merge - Join two or more development histories together

SYNOPSIS

git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit] [--no-verify] [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]] [--[no-]allow-unrelated-histories] [--[no-]rerere-autoupdate] [-m <msg>] [-F <file>] [--into-name <branch>] [<commit>…​] git merge (--continue | --abort | --quit)

DESCRIPTION Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. This command is used by git pull to incorporate changes from another repository and can be used by hand to merge changes from one branch into another.

Assume the following history exists and the current branch is master:

A---B---C topic / D---E---F---G master Then git merge topic will replay the changes made on the topic branch since it diverged from master (i.e., E) until its current commit (C) on top of master, and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes. Before the operation, ORIG_HEAD is set to the tip of the current branch (C).

A---B---C topic /
D---E---F---G---H master

A merge stops if there’s a conflict that cannot be resolved automatically or if --no-commit was provided when initiating the merge. At that point you can run git merge --abort or git merge --continue.

git merge --abort will abort the merge process and try to reconstruct the pre-merge state. However, if there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), git merge --abort will in some cases be unable to reconstruct the original (pre-merge) changes. Therefore:

Warning: Running git merge with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.

Git REMOTE

NAME

git-remote - Manage set of tracked repositories

SYNOPSIS

git remote [-v | --verbose] git remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <URL> git remote rename [--[no-]progress] <old> <new> git remote remove <name> git remote set-head <name> (-a | --auto | -d | --delete | <branch>) git remote set-branches [--add] <name> <branch>…​ git remote get-url [--push] [--all] <name> git remote set-url [--push] <name> <newurl> [<oldurl>] git remote set-url --add [--push] <name> <newurl> git remote set-url --delete [--push] <name> <URL> git remote [-v | --verbose] show [-n] <name>…​ git remote prune [-n | --dry-run] <name>…​ git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)…​]

DESCRIPTION

Manage the set of repositories ("remotes") whose branches you track.

OPTIONS

-v --verbose Be a little more verbose and show remote url after name. For promisor remotes, also show which filters (blob:none etc.) are configured. NOTE: This must be placed between remote and subcommand.

Git STASH

Name

git-stash - Stash the changes in a dirty working directory away

SYNOPSIS

git stash list [<log-options>] git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>] git stash drop [-q | --quiet] [<stash>] git stash pop [--index] [-q | --quiet] [<stash>] git stash apply [--index] [-q | --quiet] [<stash>] git stash branch <branchname> [<stash>] git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet] [-u | --include-untracked] [-a | --all] [(-m | --message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>…​]] git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet] [-u | --include-untracked] [-a | --all] [<message>] git stash clear git stash create [<message>] git stash store [(-m | --message) <message>] [-q | --quiet] <commit>

DESCRIPTION

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.

The modifications stashed away by this command can be listed with git stash list, inspected with git stash show, and restored (potentially on top of a different commit) with git stash apply. Calling git stash without any arguments is equivalent to git stash push. A stash is by default listed as "WIP on branchname …​", but you can give a more descriptive message on the command line when you create one.

Git Branching Commands

Git Commands

NAME

git-branch - List, create, or delete branches

SYNOPSIS

git branch [--color[=<when>] | --no-color] [--show-current] [-v [--abbrev=<n> | --no-abbrev]] [--column[=<options>] | --no-column] [--sort=<key>] [--merged [<commit>]] [--no-merged [<commit>]] [--contains [<commit>]] [--no-contains [<commit>]] [--points-at <object>] [--format=<format>] [(-r | --remotes) | (-a | --all)] [--list] [<pattern>…​] git branch [--track[=(direct|inherit)] | --no-track] [-f] [--recurse-submodules] <branchname> [<start-point>] git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>] git branch --unset-upstream [<branchname>] git branch (-m | -M) [<oldbranch>] <newbranch> git branch (-c | -C) [<oldbranch>] <newbranch> git branch (-d | -D) [-r] <branchname>…​ git branch --edit-description [<branchname>]

DESCRIPTION If --list is given, or if there are no non-option arguments, existing branches are listed; the current branch will be highlighted in green and marked with an asterisk. Any branches checked out in linked worktrees will be highlighted in cyan and marked with a plus sign. Option -r causes the remote-tracking branches to be listed, and option -a shows both local and remote branches.

If a <pattern> is given, it is used as a shell wildcard to restrict the output to matching branches. If multiple patterns are given, a branch is shown if it matches any of the patterns.

Note that when providing a <pattern>, you must use --list; otherwise the command may be interpreted as branch creation.

With --contains, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit), --no-contains inverts it. With --merged, only branches merged into the named commit (i.e. the branches whose tip commits are reachable from the named commit) will be listed. With --no-merged only branches not merged into the named commit will be listed. If the <commit> argument is missing it defaults to HEAD (i.e. the tip of the current branch).

The command’s second form creates a new branch head named <branchname> which points to the current HEAD, or <start-point> if given. As a special case, for <start-point>, you may use "A...B" as a shortcut for the merge base of A and B if there is exactly one merge base. You can leave out at most one of A and B, in which case it defaults to HEAD.

Note that this will create the new branch, but it will not switch the working tree to it; use "git switch <newbranch>" to switch to the new branch.

When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch. This behavior may be changed via the global branch.autoSetupMerge configuration flag. That setting can be overridden by using the --track and --no-track options, and changed later using git branch --set-upstream-to.

With a -m or -M option, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match <newbranch>, and a reflog entry is created to remember the branch renaming. If <newbranch> exists, -M must be used to force the rename to happen.

The -c and -C options have the exact same semantics as -m and -M, except instead of the branch being renamed, it will be copied to a new name, along with its config and reflog.

With a -d or -D option, <branchname> will be deleted. You may specify more than one branch for deletion. If the branch currently has a reflog then the reflog will also be deleted.

Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist in the remote repository or if git fetch was configured not to fetch them again. See also the prune subcommand of git-remote[1] for a way to clean up all obsolete remote-tracking branches.

NAME

git - the stupid content tracker

SYNOPSIS

git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch] [--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>] <command> [<args>]

DESCRIPTION

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

See gittutorial[7] to get started, then see giteveryday[7] for a useful minimum set of commands. The Git User’s Manual has a more in-depth introduction.

After you mastered the basic concepts, you can come back to this page to learn what commands Git offers. You can learn more about individual Git commands with "git help command". gitcli[7] manual page gives you an overview of the command-line command syntax.

A formatted and hyperlinked copy of the latest Git documentation can be viewed at https://git.github.io/htmldocs/git.html or https://git-scm.com/docs.

OPTIONS

-v --version Prints the Git suite version that the git program came from.

This option is internally converted to git version ... and accepts the same options as the git-version[1] command. If --help is also given, it takes precedence over --version.

-h --help Prints the synopsis and a list of the most commonly used commands. If the option --all or -a is given then all available commands are printed. If a Git command is named this option will bring up the manual page for that command.

Other options are available to control how the manual page is displayed. See git-help[1] for more information, because git --help ... is converted internally into git help ....

-C <path> Run as if git was started in <path> instead of the current working directory. When multiple -C options are given, each subsequent non-absolute -C <path> is interpreted relative to the preceding -C <path>. If <path> is present but empty, e.g. -C "", then the current working directory is left unchanged.

This option affects options that expect path name like --git-dir and --work-tree in that their interpretations of the path names would be made relative to the working directory caused by the -C option. For example the following invocations are equivalent:

git --git-dir=a.git --work-tree=b -C c status git --git-dir=c/a.git --work-tree=c/b status

-c <name>=<value> Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated by dots).

Note that omitting the = in git -c foo.bar ... is allowed and sets foo.bar to the boolean true value (just like [foo]bar would in a config file). Including the equals but with an empty value (like git -c foo.bar= ...) sets foo.bar to the empty string which git config --type=bool will convert to false.

Main porcelain commands

git-add[1] Add file contents to the index

git-am[1] Apply a series of patches from a mailbox

git-archive[1] Create an archive of files from a named tree

git-bisect[1] Use binary search to find the commit that introduced a bug

git-branch[1] List, create, or delete branches

git-bundle[1] Move objects and refs by archive

git-checkout[1] Switch branches or restore working tree files

git-cherry-pick[1] Apply the changes introduced by some existing commits

git-citool[1] Graphical alternative to git-commit

git-clean[1] Remove untracked files from the working tree

git-clone[1] Clone a repository into a new directory

git-commit[1] Record changes to the repository

git-describe[1] Give an object a human readable name based on an available ref

git-diff[1] Show changes between commits, commit and working tree, etc

git-fetch[1] Download objects and refs from another repository

git-format-patch[1] Prepare patches for e-mail submission

git-gc[1] Cleanup unnecessary files and optimize the local repository

git-grep[1] Print lines matching a pattern

git-gui[1] A portable graphical interface to Git

git-init[1] Create an empty Git repository or reinitialize an existing one

git-log[1] Show commit logs

git-maintenance[1] Run tasks to optimize Git repository data

git-merge[1] Join two or more development histories together

git-mv[1] Move or rename a file, a directory, or a symlink

git-notes[1] Add or inspect object notes

git-pull[1] Fetch from and integrate with another repository or a local branch

git-push[1] Update remote refs along with associated objects

git-range-diff[1] Compare two commit ranges (e.g. two versions of a branch)

git-rebase[1] Reapply commits on top of another base tip

git-reset[1] Reset current HEAD to the specified state

git-restore[1] Restore working tree files

git-revert[1] Revert some existing commits

git-rm[1] Remove files from the working tree and from the index

git-shortlog[1] Summarize git log output

git-show[1] Show various types of objects

git-sparse-checkout[1] Reduce your working tree to a subset of tracked files

git-stash[1] Stash the changes in a dirty working directory away

git-status[1] Show the working tree status

git-submodule[1] Initialize, update or inspect submodules

git-switch[1] Switch branches

git-tag[1] Create, list, delete or verify a tag object signed with GPG

git-worktree[1] Manage multiple working trees

gitk[1] The Git repository browser

scalar[1] A tool for managing large Git repositories

Git Commands

git checkout

In addition to checking out old commits and old file revisions, git checkout is also the means to navigate existing branches. Combined with the basic Git commands, it’s a way to work on a particular line of development.

;