I want to share what i have learnt so for from git. Git is version control system which helps us to track changes in our code and shared among the team members. It's really a great tool.
Here are some Basic commands that i have learned with simple words.
git init
It creates a new git repository, .git a hidden file will be created in the project folder and git starts to track everything.git status
Shows the current state of your files and any time we can see what's going ongit add
Changes to include in the next commit and can be used before commit changes.
To add specific file:
git add filename.txt
To add everything:
git add .
- git commit command used to saves the changes after you add the your changes
git commit -m "Latest changes in home page"
- git log Show the history if commits
git log
- git branch shows all the branches or create a new branch
List out the branches:
git branch
Create a Branch:
git branch newfeature
- git checkout Command will switch between branches
git checkout newfeature
- git merge Command will merge or combine one branch to another branch and used when a newfeature is ready and you want add it to the main or master branch.
git checkout master
git merge new-feature
git clone
Command will copy remote repository to local machine and its used when multiple person work on same project.
git clone https://github.com/git push
Command will upload the changes into remote repository and its used after committing the changes locally.
git push origin main
- git pull Command will get the latest changes from the remote repository and its used before starting your work so that you are upto date .
git pull origin main
These are the basics git command.
Top comments (2)
Good start on git! Nice work
Thank You. Will Try to create post regularly
Some comments may only be visible to logged-in visitors. Sign in to view all comments.