Level 5

Name Link Status Mentioned
Level 5 https://github.com/aruncs31s/git_by_doing_level_5 Done

Task: To configure git properly , and explore additional usage of git log.

Lets recap

Up until you have seen the following commands

git status # to check the status of the repo 
git log # to see the commit history
git add # to add files to the staging area
git commit # to commit the staged files
git log # to see the commit history
git branch # to see the branches
git checkout # to switch branches

And you will need to use most of them inorder to complete this level.

Configuring Git

Let's start by properly configuring git. I have already explained git log in Level 3 of this course. And you may remember the following, a single log entry may look like this.
gitlog.png

![alt text](/img/user/11 Classes/Git by Doing/attachments/imgs_for_3/image-8.png)
You can see that , there are a few details like

git config --get user.name

you will obtain the following

Arun CS

and to get the email run the following.

git config --get user.email
aruncs31ss@gmail.com

I was able to get this because i configured it , when i installed git.
In order to configure things like name and email , run the following

git config user.name "Arun CS"

For example if you want to change you name to something like "Dog", you can run the following command:

git config user.name "Dog"

gitconfig-1.png

This type of configuration is called local or project or repo level configuration. What i mean by that is that , look at the following example,
localconfig.png
when i run

git config --get user.name

it prints Dog , but when i change repo , or directory the name also changes.
To make the changes global you should use the --global flag like this,

git config --global user.name "Arun CS"
Tip

you can also get the global configuration like the following
Screenshot 2025-07-19 at 2.55.11 PM.png

So there are 2 types of configuration , and the are global and local and stored in ~/.gitconfig and .git/config respectively.

graph LR
		A[Git Config] --> B[Global Config]
		A --> C[Local Config]
		B --> D[~/.gitconfig]
		C --> E[.git/config]

Where these will be used?

You have already learned about git commit and git log in Level 3 , right?. So when you do a git log you see see the following right?

git log --author=zeidan

zeidancommit2.png
There is only single commit becouse , zeidan has done only one commit , and if you also want what he have changed you can include the -p flag

git log --author=zeidan -p

zeidancommit3.png

draw1.png
So you get a lot of infomation from using git log and with the -p flag.

Tip

When you check out a commit , you will see the history of commit upto you commit only. dont get it?
Take a look at the following example
draw2.png
Where i have 4 comits , commit 1 , commit 2, commit 3 and commit 4. and when i checkout commit 3 i will no longer se commit 4 in the log.