Table of contents
Some common commands
- pwd
pwd stands for "present working directory".It is used to check in which directory are we on currently.
so this shows I am currently in c -> Users -> dsouz directory
- cd
cd stands for "change directory".If we want to change our directory to work we can use this command.
here we changed to the desktop directory using cd command.
setting username
It is crucial to set a username so that when we work on projects in groups the other members can check what implementations we have done on the project.
We use git config --global user.name to set our username.
We can also check which username is saved using the same command.
setting email id
This step is just as important as saving the username. We use git config --global user.email to set the email id.
we can also check which email is saved using same command.
Three States In Git Workflow
The above image shows the three states of git in workflow. We can check for the state of our projects by the git status command.
First, create an empty folder in your system. On the git bash terminal change the directory to the folder and type:
It displays fatal: not a git repository (or any of the parent directories): .git.This means we have not yet made a commit.
To make a commit we first initialize the file with the git init command.
This has initialized our empty git repository.
Our next step is to add files in staging area. For this, we use git add --a.
To check if they are in staging we need to again check their status.
This displayed content says that the two files in my folder excel.xlsx and text.txt have been staged.No commits are made yet.
To commit we use git commit -m "Initial commit"
So the commit has been made. Again we need to check the git status.
Nothing left to commit in the folder.
To check the log and see the commits we made use git log command.
This also generates a hash code for our commit.
This is how we track our files.