Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 13, 2021 06:25 pm GMT

Mostly used git commands for beginners

Git is a magic bullet for developers to track your work. Git also differentiates the other teammate work by using git commands. Here are the 10 most used git commands.

  1. git init
  2. git clone
  3. git add
  4. git status
  5. git diff
  6. git commit
  7. git push
  8. git pull
  9. git revert
  10. git checkout

git init

Git init is used to initialise the git to a local repository. But when are you clone from remotely then you don't need the git init.
Practice:-

Alt Text

git clone [remote_url]

Git clone is used to creating an identical copy of a Git Remote Repository to the local machine.
Practice:-

Alt Text

git add [file name/.]

Git add is used to add the modified files in the staged area. There are following ways to use git add, by adding the entire folder and specific files. Dot means the entire folder.
Practice:-

Alt Text

git commit -m "Your message about the commit"

Git commit is used to add the changes with a unique message in an individual file or set of files. Git commits also creates a unique id. A "unique message" shortly describes what changes you have done. It also helps you track your commits.
Practice:-

Alt Text

git status

Git status is used to check the status of the modified files. It also shows which files are staged, unstaged, and untracked.
Practice:-

Alt Text

git diff

Git diff is used to track the difference between the changes made on a file.
Practice:-

Alt Text

git revert [commit id]

Git revert is used to undo the changes of the given commit which we have pushed in a "remote" repository and changes add in the current branch. Without losing your previous commit.
Practice:-

Alt Text

git push

Git push is used to push all the changes locally to the remote repository.
Practice:-

Alt Text

git pull

Git pull is used to pull all the changes from remote to the local repository.
Practice:-

Alt Text

git checkout [file/branchname/commit id]

Git Checkout is used to switch between files, branches and commits.
Practice:-

Alt Text

Conclusion

In this article, I cover mostly used git commands for beginners. I also define the syntax, purpose and usage of command at one place.
I hope this article help to learn git commands.


Original Link: https://dev.to/shilpa3495/mostly-used-git-commands-for-beginners-3m37

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To