LinuxSysAdminsDoc/Readme.md

2.4 KiB
Raw Blame History

Git

GitHub Logo

Git Cheat Sheet

Basic commands

initialize an existing directory as a Git repository

$ git init
Initialized empty Git repository in C:/Users/Admin/Documents/Git/.git/

show modified files in working directory, staged for your next commit

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Readme.md
        image.jpg

nothing added to commit but untracked files present (use "git add" to track)

add a file as it looks now to your next commit (stage)

$ git add Readme.md image.jpg 

commit your staged content as a new commit snapshot

$ git commit -m "First Commit"
[master (root-commit) 784ae2e] First Commit
 Committer: unknown <Admin@FOR209-03.irisib.lan>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 2 files changed, 61 insertions(+)
 create mode 100644 Readme.md
 create mode 100644 image.jpg

set a name & email that is identifiable for credit when review version history

$ git config --global user.name “[firstname lastname]”

$ git config --global user.email “[valid-email]

show all commits in the current branchs history

$ git log
commit 784ae2e2d10720c23eb7cebdf8386ef2157fe628 (HEAD -> master)
Author: unknown <Admin@FOR209-03.irisib.lan>
Date:   Thu Apr 1 12:11:34 2021 +0200

    First Commit

Checker le satus

git status

Ajouter un element dans la branche

git add Readme.md

Commit les changement

git commit -m "First commit"

Show all commit

git checkout

Merge

git merge

Setup

Configuring user information used across all local repositories

git config --global user.name “[firstname lastname]”

set a name that is identifiable for credit when review version history

git config --global user.email “[valid-email]”

set an email address that will be associated with each history marker

git config --global color.ui auto

set automatic command line coloring for Git for easy reviewing