• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / Archives for Git

Git

GitHub

Create an empty Git repository or reinitialize an existing one

git init

Start a new Git repository for an existing code base

$ cd /path/to/my/codebase
$ git init      (1)
$ git add .     (2)
$ git commit    (3)

Customizing Git Configuration

$ git config --global user.name "John Doe" 
$ git config --global user.email johndoe@example.com

Create an empty file named readme.md

$ touch readme.md

Get the status

$ git status

Add file contents to the index

$ git add readme.md

Record changes to the repository

$ git commit -m 

Show commit logs

$ git log

Staging Area

git staging area

Add a ‘-a’ to your commit command in order to add all changes to all files to the staging area.

$ git commit -a
git commit -a

Modify the readme.md file

$ nano readme.md

Let’s see the git status

$ git status
git status

Commit all changes to all files to the staging area

$ git commit -a -m "Modified readme.md"
git-commit

See the changes

$ git log
git-log

Switch branches or restore working tree files

If You would like to restore a previous version of the file You have to use the git checkout command. Every commit has a very long ID, but You only need to type the first 7 characters.

git checkout

Filed Under: Other Tagged With: Git

Primary Sidebar

  • angular.io
© 2026 WP Flames - All Right Reserved