bvfnbk

Notes of bvfnbk

Software development and other stuff.

git

Jul 22, 2022
1 min read
man linux unix git

Name

git - the stupid content tracker

Examples

Initialize Repository

$ mkdir repository/
$ cd repository/
$ touch README.md
$ git add README.md
$ git commit -m 'initial commit'

Pushing

$ git push [--set-upstream | -u] $REMOTE $BRANCH [--force]

Remotes

List

$ git remote -v
origin git@github.com:$USER/$REPOSITORY.git (fetch)
origin git@github.com:$USER/$REPOSITORY.git (push)

Delete

$ git remote remove $NAME

Add

$ git remote add $NAME git@github.com:$USER/$REPOSITORY.git

Submodules

Add Submodule

$ cd working-directory/
$ git submodule add $URL [$MODULE_PATH]

This creates (or updates) the .gitmodules file in the working directory and a file located at $MODULE_PATH. These files must be staged for commit

$ git add .gitmodules
$ git add $MODULE_PATH

and committed.