7 Git commands that every developer should know

Git is powerful because you can see the history of your code.

what is Git

It is a popular version control system.

7 Git commands

git init

creates

git clone [url]

Copies a git repository located at a url into a new directory which includes all files, history and branches.

A “fork” on GitHub will create a copy of a repository and make you the owner.

git status

Shows the current state of the repository.

It can show changed, added and removed files.

git add [path]

Tell Git to include all the files at a [path] in the next commit.

If you modify the files after git-adding them, git will remember their initial state when you added them.

git reset [path]

Undoes git add and removes files from the index.

what is index

Files added with git add but not committed.

git reset [–soft | –hard] [commit]

Restores repository to a specific commit.

git commit -m [message]

creates a new checkpoint in the project with a message. Stores the state of any added files.

Use -m flag to use the message as the commit message.

conclusion

Git is a powerful tool to maintain a codebase.

javascript
why JavaScript methods are useful

You can think of a method as an action that a number, string or object can perform or have taken on it.

javascript
primitives vs objects

Primitives are immutable and passed by value. Objects are mutable and stored by reference.