Hello!
Today we are going to start with some basic Git commands.
Here we go!
Git init:
it will initialize git to track the directory or folder.
Git Status:
You can check the status of the files and whether they are being tracked by git or not, using this command.
Git add:
If we want to track the files in the git-initialized project folder, we have to stage them, for staging you have to use this command:
git add .
if you want to stage a specific file, you can use : git add <file_name>
Git Commit:
Once we stage the changes or files, we are ready to commit them to our repository using the command below:
git commit -m "<Custom Message>"
Git Branch:
To handle the workspace of multiple developers, we use branches.
To create a branch - git branch <new_branch_name>
To delete a branch - git branch -d <branch_name>
To see all the branches - git branch
Git Log:
If we want to check the log for every commit detail, we can use "git log".
git log -- graph command creates a graphic overview of how a developer's various development pipelines have branched and merged over time.
git log --graph --pretty=oneline will give the consolidated result of the git log. This is my favourite command, you can have a look at it too.
That's all for today!
In the next blog, we will talk about a scenario where we will use common git commands to solve it so that we can get a feel of real problem-solving.
If this post was helpful, please follow and click the ๐ button below to show your support.
_ Thank you for reading!
_Sudipa