• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / Other / GitHub

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

About Gabor Flamich

I'm a web developer and designer based in Budapest, Hungary. In recent years, I've documented hundreds of solutions I came across during development. This site is an archive for useful code snippets on WordPress, Genesis Framework and WooCommerce. If You have any questions related to WordPress development, get in touch!

Primary Sidebar

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