Git Guide 4: Take Your First Steps With Git

Written by artwalker | Published 2024/02/22
Tech Story Tags: git | github | git-for-beginners | how-do-i-use-git | is-git-good-for-beginners | git-tutorial | how-to-get-started-with-git | easy-git-tutorial

TLDRgit config; git init; git add; git status; git commit;via the TL;DR App

Command:

$ git config --global user.email "[email protected]"
$ git config --global user.name "My name"
$ mkdir checks
$ cd checks

# Initialized empty Git repository in `/home/user/checks/.git/`
$ git init

$ ls -la

Code output:

total 12

drwxrwxr-x  3 user user 4096 Jul  9 18:16 .

drwxr-xr-x 18 user user 4096 Jul  9 18:16 ..

drwxrwxr-x  7 user user 4096 Jul  9 18:16 .git

Command:

$ ls -l .git/

Code output:

total 32

drwxrwxr-x 2 user user 4096 Jul  9 18:16 branches

-rw-rw-r-- 1 user user   92 Jul  9 18:16 config

-rw-rw-r-- 1 user user   73 Jul  9 18:16 description

-rw-rw-r-- 1 user user   23 Jul  9 18:16 HEAD

drwxrwxr-x 2 user user 4096 Jul  9 18:16 hooks

drwxrwxr-x 2 user user 4096 Jul  9 18:16 info

drwxrwxr-x 4 user user 4096 Jul  9 18:16 objects

drwxrwxr-x 4 user user 4096 Jul  9 18:16 refs

Command:

$ cp ../disk_usage.py .
$ ls -l

Code output:

-rw-rw-r-- 1 user user 657 Jul  9 18:26 disk_usage.py

Command:

$ git add disk_usage.py 
$ git status

Code output:

On branch master

No commits yet

Changes to be committed:

  (use "git rm --cached <file>..." to unstage)

	new file:   disk_usage.py

Command:

$ git commit

Code output:

 GNU nano 3.2         /home/user/checks/.git/COMMIT_EDITMSG                    

# Please enter the commit message for your changes. Lines starting

# with '#' will be ignored, and an empty message aborts the commit.

#

# On branch master

#

# Initial commit

#

# Changes to be committed:

#       new file:   disk_usage.py


Written by artwalker | Passionate about Crafting Intelligent OS & Pioneering TinyML Applications for Resource-Constrained Devices
Published by HackerNoon on 2024/02/22