đ git status
â Git-āĻ āĻāĻĒāύāĻžāϰ āĻ
āĻŦāϏā§āĻĨāĻžāύ āĻāĻžāύā§āύ â
git status
āĻāĻŽāĻžāύā§āĻĄāĻāĻŋ Git āϰāĻŋāĻĒā§āĻāĻŋāĻāϰāĻŋāϰ āĻŦāϰā§āϤāĻŽāĻžāύ āĻ
āĻŦāϏā§āĻĨāĻž āĻĻā§āĻāĻžāύā§āϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻž āĻšā§āĨ¤ āĻāĻāĻŋ āĻāĻĒāύāĻžāĻā§ āĻŦāϞ⧠āĻĻā§ā§:
- āĻā§āύ āĻĢāĻžāĻāϞ āĻĒāϰāĻŋāĻŦāϰā§āϤāĻŋāϤ āĻšā§ā§āĻā§
- āĻā§āύ āĻĢāĻžāĻāϞ āϏā§āĻā§āĻ āĻāϰāĻž āĻāĻā§
- āĻā§āύ āĻĢāĻžāĻāϞ āĻāĻāύāĻ āĻāĻŽāĻŋāĻ āĻšā§āύāĻŋ
- āĻā§āύ āĻĢāĻžāĻāϞ untracked (āύāϤā§āύ)
â āĻŽā§āϞāĻŋāĻ āĻāĻŽāĻžāύā§āĻĄ â
git status
git status
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§§: āϏāĻŦāĻāĻŋāĻā§ āĻ āĻŋāĻāĻ āĻžāĻ āĻāĻā§ â
$ git status
On branch main
nothing to commit, working tree clean
$ git status
On branch main
nothing to commit, working tree clean
đ āĻ āϰā§āĻĨ: āĻā§āύ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āύā§āĻ, āϏāĻŦāĻāĻŋāĻā§ āĻāĻŽāĻŋāĻ āĻšā§ā§ āĻā§āĻā§āĨ¤
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ⧍: āύāϤā§āύ āĻĢāĻžāĻāϞ āϤā§āϰāĻŋ āĻāϰāĻž āĻšā§ā§āĻā§ â
$ touch hello.txt
$ git status
On branch main
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello.txt
nothing added to commit but untracked files present
$ touch hello.txt
$ git status
On branch main
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello.txt
nothing added to commit but untracked files present
đ āĻ
āϰā§āĻĨ: hello.txt
āύāϤā§āύ āĻĢāĻžāĻāϞ, Git āĻāĻāĻŋ āĻā§āϰā§āϝāĻžāĻ āĻāϰāĻā§ āύāĻžāĨ¤
đ āϏāĻŽāĻžāϧāĻžāύ:
git add hello.txt
git add hello.txt
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§Š: āĻāĻāĻāĻŋ āĻĢāĻžāĻāϞ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻšā§ā§āĻā§ â
$ echo "new line" >> hello.txt
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: hello.txt
$ echo "new line" >> hello.txt
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: hello.txt
đ āĻ āϰā§āĻĨ: āĻĢāĻžāĻāϞāĻāĻŋ āĻāĻā§ āĻā§āϰā§āϝāĻžāĻ āĻāϰāĻž āĻāĻŋāϞ, āĻāĻŋāύā§āϤ⧠āĻāĻāύ āύāϤā§āύ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻšā§ā§āĻā§, āϝāĻž āĻāĻāύāĻ āϏā§āĻā§āĻ āĻāϰāĻž āĻšā§āύāĻŋāĨ¤
đ āϏāĻŽāĻžāϧāĻžāύ:
git add hello.txt
git add hello.txt
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§Ē: āϏā§āĻā§āĻ āĻ āĻāύāϏā§āĻā§āĻ āĻŽāĻŋāĻļā§āϰāĻŋāϤ āĻ āĻŦāϏā§āĻĨāĻž â
$ git add hello.txt
$ echo "another line" >> hello.txt
$ git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: hello.txt
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: hello.txt
$ git add hello.txt
$ echo "another line" >> hello.txt
$ git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: hello.txt
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
modified: hello.txt
đ āĻ āϰā§āĻĨ: āĻāĻŋāĻā§ āĻ āĻāĻļ āϏā§āĻā§āĻ āĻāϰāĻž āĻšā§ā§āĻā§, āĻāĻŦāĻžāϰ āĻāĻŋāĻā§ āĻ āĻāĻļ unstaged āĻāĻā§āĨ¤
đ āĻĻā§āĻāϤ⧠āĻāĻžāĻāϞā§:
git diff hello.txt # unstaged changes
git diff --staged # staged changes
git diff hello.txt # unstaged changes
git diff --staged # staged changes
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§Ģ: āĻ āύā§āĻāĻā§āϞ⧠āĻĢāĻžāĻāϞ āύāĻŋā§ā§ āĻāĻžāĻ â
$ git status
On branch main
Changes not staged for commit:
modified: index.html
modified: app.js
Untracked files:
new-script.js
$ git status
On branch main
Changes not staged for commit:
modified: index.html
modified: app.js
Untracked files:
new-script.js
đ āĻ
āϰā§āĻĨ: index.html
āĻ app.js
āĻĢāĻžāĻāϞ āĻĒāϰāĻŋāĻŦāϰā§āϤāĻŋāϤ āĻšā§ā§āĻā§, āĻāĻŦāĻ new-script.js
āύāϤā§āύ āĻĢāĻžāĻāϞāĨ¤
đ āĻāϰāĻŖā§ā§:
git add index.html app.js new-script.js
git commit -m "Updated HTML and JS, added new script"
git add index.html app.js new-script.js
git commit -m "Updated HTML and JS, added new script"
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§Ŧ: āĻĢāĻžāĻāϞ āĻĄāĻŋāϞāĻŋāĻ āĻāϰāĻž āĻšā§ā§āĻā§ â
$ rm old-file.txt
$ git status
On branch main
Changes not staged for commit:
deleted: old-file.txt
$ rm old-file.txt
$ git status
On branch main
Changes not staged for commit:
deleted: old-file.txt
đ āĻ
āϰā§āĻĨ: old-file.txt
āĻĢāĻžāĻāϞāĻāĻŋ āĻĄāĻŋāϞāĻŋāĻ āĻāϰāĻž āĻšā§ā§āĻā§, āĻāĻŋāύā§āϤ⧠Git āĻāĻžāύ⧠āύāĻžāĨ¤
đ āϏā§āĻā§āĻ āĻāϰāϤā§:
git add -u
# āĻ
āĻĨāĻŦāĻž
git rm old-file.txt
git add -u
# āĻ
āĻĨāĻŦāĻž
git rm old-file.txt
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§: āĻĢāĻžāĻāϞ āύāĻžāĻŽ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ (rename) â
$ git mv about.html about-us.html
$ git status
On branch main
Changes to be committed:
renamed: about.html -> about-us.html
$ git mv about.html about-us.html
$ git status
On branch main
Changes to be committed:
renamed: about.html -> about-us.html
đ āĻ
āϰā§āĻĨ: about.html
āĻĢāĻžāĻāϞā§āϰ āύāĻžāĻŽ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻāϰāĻž āĻšā§ā§āĻā§, āĻāĻŦāĻ Git āĻāĻāĻŋ āĻā§āϰā§āϝāĻžāĻ āĻāϰāĻā§āĨ¤
đ§Ē āĻāĻĻāĻžāĻšāϰāĻŖ ā§Ž: .gitignore
āĻāĻžāĻ āĻāϰāĻā§ āĻāĻŋ āύāĻž? â
$ echo "node_modules/" >> .gitignore
$ mkdir node_modules
$ git status
On branch main
nothing to commit, working tree clean
$ echo "node_modules/" >> .gitignore
$ mkdir node_modules
$ git status
On branch main
nothing to commit, working tree clean
đ āĻ
āϰā§āĻĨ: node_modules/
āĻĢā§āϞā§āĻĄāĻžāϰ Git āĻāĻāύā§āϰ āĻāϰāĻā§āĨ¤
đ git status
āĻā§ āĻāϰāĻ āϏāĻāĻā§āώā§āĻĒā§ āĻĻā§āĻāϤ⧠āĻāĻžāύ? â
āϏāĻžāĻā§āϏā§āĻā§āĻĄ āĻĢā§āϞā§āϝāĻžāĻ: -s
āĻŦāĻž --short
â
$ git status -s
M index.html
?? new.txt
A contact.html
$ git status -s
M index.html
?? new.txt
A contact.html
āĻĒā§āϰāϤā§āĻ | āĻ āϰā§āĻĨ |
---|---|
M | Modified (āĻĒāϰāĻŋāĻŦāϰā§āϤāĻŋāϤ) |
A | Added (āϏā§āĻā§āĻāĻĄ āύāϤā§āύ āĻĢāĻžāĻāϞ) |
?? | Untracked file (āύāϤā§āύ) |
D | Deleted (āĻŽā§āĻā§ āĻĢā§āϞāĻž) |
đ§ āĻā§āύ git status
āĻāϤ āĻāϰā§āϰāĻŋ? â
- āĻā§ āϏā§āĻā§āĻ āĻāϰāĻž āĻšā§ā§āĻā§ āĻāϰ āĻā§ āĻšā§āύāĻŋ â āϏāĻšāĻā§ āĻĻā§āĻāĻž āϝāĻžā§
- āĻā§āϞ āĻāϰ⧠āĻāĻŋāĻā§ āĻŦāĻžāĻĻ āĻĒā§ā§āĻā§ āĻāĻŋ āύāĻž â āĻŦā§āĻā§ āĻĢā§āϞāĻž āϝāĻžā§
.gitignore
āĻ āĻŋāĻ āĻŽāϤ⧠āĻāĻžāĻ āĻāϰāĻā§ āĻāĻŋ āύāĻž āϝāĻžāĻāĻžāĻ āĻāϰāĻž āϝāĻžā§
đ ī¸ āĻĒā§āϰāĻžāĻāĻāĻŋāϏā§āϰ āĻāύā§āϝ āĻĒāϰāĻžāĻŽāϰā§āĻļ â
- āύāϤā§āύ āĻĢāĻžāĻāϞ āϤā§āϰāĻŋ āĻāϰ⧠āĻĻā§āĻā§āύ
git status
āĻāĻŋāĻāĻžāĻŦā§ āϰāĻŋāĻĒā§āϰā§āĻ āĻāϰ⧠- āĻāĻāĻ āĻĢāĻžāĻāϞ⧠āĻāĻāĻžāϧāĻŋāĻ āĻŦāĻžāϰ āĻĒāϰāĻŋāĻŦāϰā§āϤāύ āĻāϰ⧠āϏā§āĻā§āĻ āĻ unstaged āĻ āĻŦāϏā§āĻĨāĻž āĻŦā§āĻā§āύ
- āϏā§āĻā§āĻ āĻāϰ⧠āĻāĻŦāĻžāϰ
git restore --staged
āĻĻāĻŋā§ā§ āϏā§āĻā§āĻ āĻŽā§āĻā§ āĻĻāĻŋāύ .gitignore
āĻĢāĻžāĻāϞ āĻĻāĻŋā§ā§ āĻāĻŋāĻā§ āĻĢāĻžāĻāϞ āĻŦāĻžāĻĻ āĻĻāĻŋāύ
đ¯ āϏāĻāĻā§āώā§āĻĒā§ āĻŽāύ⧠āϰāĻžāĻā§āύ â
āĻ āĻŦāϏā§āĻĨāĻž | git status āĻ āĻā§ āĻĻā§āĻāĻžā§ |
---|---|
āύāϤā§āύ āĻĢāĻžāĻāϞ | Untracked files |
āĻĒāϰāĻŋāĻŦāϰā§āϤāĻŋāϤ āĻāĻŋāύā§āϤ⧠unstaged | Changes not staged for commit |
āϏā§āĻā§āĻ āĻāϰāĻž āĻĒāϰāĻŋāĻŦāϰā§āϤāύ | Changes to be committed |
āĻĢāĻžāĻāϞ āĻŽā§āĻā§ āĻĢā§āϞāĻž | deleted: |
āĻĢāĻžāĻāϞ āϰāĻŋāύā§āĻŽ āĻāϰāĻž | renamed: |
đ āĻāĻĒāϏāĻāĻšāĻžāϰ â
git status
āĻšāϞ⧠āĻāĻĒāύāĻžāϰ Git āĻĒā§āϰāĻā§āĻā§āĻā§āϰ āĻŦāϰā§āϤāĻŽāĻžāύ āĻāĻŋāϤā§āϰāĨ¤ āĻāĻāĻŋ āύāĻŋā§āĻŽāĻŋāϤ āĻāĻžāϞāĻŋā§ā§ āĻā§āϞ⧠āĻā§āϞ āĻāĻŽ āĻšāĻŦā§, āϏāĻŽā§ āĻŦāĻžāĻāĻāĻŦā§, āĻāĻŦāĻ āĻāϤā§āĻŽāĻŦāĻŋāĻļā§āĻŦāĻžāϏ āĻŦāĻžā§āĻŦā§āĨ¤