Skip to content

Instantly share code, notes, and snippets.

@purveshmakode24
Last active May 28, 2020 20:14
Show Gist options
  • Save purveshmakode24/aa517c8bca568c67a4ef5180a44f2936 to your computer and use it in GitHub Desktop.
Save purveshmakode24/aa517c8bca568c67a4ef5180a44f2936 to your computer and use it in GitHub Desktop.
Some Important Git Commands Need to Remember.

Important Git commands to remember

1. To discard changes in working directory:

git checkout -- <file_name>

2. git add

Adds files in the to the staging area for Git. Before a file is available to commit to a repository, the file needs to be added to the Git index (staging area). There are a few different ways to use git add, by adding entire directories, specific files, or all unstaged files.

Usage:

$ git add <file or directory name>

In Practice:

# To add all files not staged:
$ git add .

# To stage a specific file:
$ git add index.html

# To stage an entire directory:
$ git add css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment