previous commit
Current src
app
|__src
| |__test.php
|___composer.json
Action
Delete: app/src/test.php
Add new file: app/src/Test2.php
Modify app/composer.json
After change
app
|__src
| |__test.php
| |__Test2.php
|___composer.json
Prepare for this commit
Check change files
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: composer.json
deleted: src/test.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
include/
src/Test2.php
no changes added to commit (use "git add" and/or "git commit -a")
Check difference code
$ git diff
diff --git a/composer.json b/composer.json
index b73a973..095b55f 100644
--- a/composer.json
+++ b/composer.json
@@ -10,5 +10,6 @@
"psr-4": {
"ourcodeworld\\HelloComposer\\": "src/"
}
- }
+ },
+ "license": "MIT"
}
\ No newline at end of file
diff --git a/src/test.php b/src/test.php
deleted file mode 100644
index 3d89734..0000000
--- a/src/test.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-echo '11';
-
Doing commit && push code
Add change files to commit
add change files (insert/update/delete) to commit
git add composer.json
git add src/test.php
git add src/Test2.php
Check status change
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: composer.json
new file: src/Test2.php
deleted: src/test.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
include/
Commit with messages
$ git commit -m "message for commit: modified: composer.json, add new file: src/Test2.php; deleted file: src/test.php"
[master 0639171] message for commit: modified: composer.json, add new file: src/Test2.php; deleted file: src/test.php
3 files changed, 2 insertions(+), 4 deletions(-)
create mode 100644 src/Test2.php
delete mode 100644 src/test.php
Push code to origin
$ git push origin master
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 435 bytes | 435.00 KiB/s, done.
Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/quocvo87/composer.git
31e2c0e..0639171 master -> master