Git repository commands

In this post you will learn Git commands with example.
1. git clone: This command clone existing repository 

2. git init: This command create new repository in existing directory.

3. git status: this command check the status of working repository , ie which is changed which is staged which is not part of staged, also show which file is conflict.

4. git add: this command is use to add file in staging area before committing file in repository. It any file change you should need to run this command before committing file. To check file status you always need to run git status command.

5. git commit: This command is use to commit changes into repository. This is needed to be run after adding file into staging area. Use –m flag to specify commit message, If you leave this your default editor opened and you need to enter comment there.

6. git log: All git operation you performed it added in local .git folder. To check all log run this command

7. git rm:  command to delete the file from your working tree and record the deletion of the file in the staging area.

8. git push:  this command send changes to remote repository.


9. git pull: this command allows you to get the latest changes from another repository for the current branch.

1 comment:

  1. Nice one, can you please give example on how to resolve conflicts

    ReplyDelete

Leave your comments, queries, suggestion I will try to provide solution