Lets continue commits and create a mental model (visual git)
- Lets create directory and make commits
mkdir commit_graphs
cd commit_graphs/
git init
touch Readme.md
git status
git add .
git commit -m "first"

- Now lets make some more changes
echo "hello" > Readme.md
git status
git add .
git commit -m "second"

echo "hello1" >> Readme.md
git status
git add .
git commit -m "third"
echo "hello2" >> Readme.md
git status
git add .
git commit -m "fourth"
echo "hello3" >> Readme.md
git status
git add .
git commit -m "fifth"

- Git always points to latest commit.
- What git is pointing is denoted by
HEAD
-
In git this graph starts with a default name called as master.
-
Commit id is SHA1 Hash of
- previous commit
- current changes
- author
- datetime
- message
-
Git only tracks files not folders
-
Using
git add
git add <filename>
git add . # Add all changes in current and child directories
git add -A # Add all changes
git add -u # Add only modified changes
- Lets learn what is untracked and modified
- untracked: is a new file which was not part of git commits
- modified: existing file which was part of git commits changed
- deleted: existing file which was part of git commits deleted
- renamed (it will appear in staging area)

Like this:
Like Loading...