DEV Community

Vasudevan Tamilarasan
Vasudevan Tamilarasan

Posted on

Git Commands

Payilagam - Day - 05: 18-Feb-2024

Topic: Git Commands

Git commands used to manipulate the workflow of the Version control of our projects.

  1. git clone <project link (.git)>

    It clones the remote repository to our local repository in our local machine.

  2. git add <filename> (or) .

    This command used to stage the changes in our local repository to a staging area, hence git easy to commit the changes and its versions.

  3. git commit -m "commit message"

    In this step, we made the commit to our local repository(.git) with version info's and with a commiit messages. Commit message will be anything but it should be reasonable.

  4. git push

    For now, we make the version controls only within our local system. git push command used to push the source files and version info to the connected remote repository, in this case we use Gitlab, you may use Github or any other repository management systems.

  5. git restore --stagged <filename>

    This command restore the tracked changes to its default state(i.e git leaves the tracking information from its memory or untracked state).

  6. git log (or) git log --oneline

This shows the logs of the push and pull requests made to the local repository.

Note: These all commands only works within a directory, where we initialized the git repository, or else these commands won't work either.

Top comments (0)