You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
1.4 KiB
132 lines
1.4 KiB
= Git!
|
|
Apostolos rootApostolos@swarmlab.io
|
|
// Metadata:
|
|
:description: Git instructions
|
|
:keywords: git
|
|
ifndef::env-browser[]
|
|
:data-uri:
|
|
endif::[]
|
|
:images-cdn: http://localhost:3080/images
|
|
:toc: right
|
|
:toc-title: Table of contents
|
|
:toclevels: 4
|
|
:source-highlighter: highlight
|
|
:no-header-footer:
|
|
:nofooter:
|
|
:last-update-label!:
|
|
:icons: font
|
|
:sectnums:
|
|
:url_mongodb: https://en.wikipedia.org/wiki/MongoDB
|
|
|
|
:hardbreaks:
|
|
|
|
{empty} +
|
|
{empty}
|
|
|
|
:!hardbreaks:
|
|
|
|
== Installation
|
|
|
|
.install
|
|
|
|
[source,bash]
|
|
----
|
|
apt-get install git
|
|
----
|
|
|
|
== Preparation
|
|
|
|
.Setting up name and e-mail address
|
|
|
|
[source,bash]
|
|
----
|
|
git config --global user.name "Your Name"
|
|
git config --global user.email "email@foo.com"
|
|
----
|
|
|
|
== Create repo
|
|
|
|
.Create a repository
|
|
|
|
[source,bash]
|
|
----
|
|
git init
|
|
----
|
|
|
|
== Create a “HelloWorld” file
|
|
|
|
.Hello world!
|
|
|
|
[source,bash]
|
|
----
|
|
mkdir HelloWorld
|
|
touch HelloWorld/hello
|
|
----
|
|
|
|
== Add HelloWorld
|
|
|
|
.Add file
|
|
|
|
[source,bash]
|
|
----
|
|
git add HelloWorld
|
|
git commit -m "Hello World!"
|
|
----
|
|
|
|
[TIP]
|
|
====
|
|
.You'd better not do that
|
|
|
|
[source,bash]
|
|
----
|
|
git commit ‐a
|
|
e.g.
|
|
git add; git commit
|
|
----
|
|
====
|
|
|
|
== Check Status
|
|
|
|
.Check status
|
|
|
|
[source,bash]
|
|
----
|
|
git status
|
|
----
|
|
|
|
|
|
|
|
== Show
|
|
|
|
=== Show history
|
|
|
|
.git log
|
|
|
|
[source,bash]
|
|
----
|
|
git log
|
|
----
|
|
|
|
=== Show config
|
|
|
|
.git config
|
|
|
|
[source,bash]
|
|
----
|
|
git config --list
|
|
----
|
|
|
|
== Git workflow
|
|
|
|
|
|
.Git workflow
|
|
|
|
[source,bash]
|
|
----
|
|
touch HelloWorld/hello1
|
|
git status
|
|
git add HelloWorld
|
|
git status
|
|
git commit -m "Hello "
|
|
git status
|
|
----
|
|
|