• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
  • Notes
  • About
  • Contact
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

Tags

Ajax Analytics Animation API attributes calc Card click combinators CSS Date DOM es5 es6 fetch filter flexbox FontAwesome Git gradient Grid GSAP hover htaccess ipad jQuery json landing layout masonry Parallax PHP recaptcha SASS selecltors selectors shadow SimpleBar skew SQL sticky SVG toggle video

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy / Terms of Service
© 2022 WP Flames - All Right Reserved