Difference between revisions of "Git commit"
Jump to navigation
Jump to search
| (36 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
| − | {{ | + | {{lowercase}} |
| + | Steps: <code>[[git add]]</code> -> <code>[[git commit]]</code> -> <code>[[git push]]</code> | ||
| − | touch README.md | + | * <code>[[git commit --help]]</code> |
| + | |||
| + | == Basic example == | ||
| + | [[touch]] README[[.md]] | ||
[[git add]] README.md | [[git add]] README.md | ||
git commit -m "Creating README" | git commit -m "Creating README" | ||
| − | [[git push | + | [[git push -u origin master]] |
| − | + | [[git commit -a]] | |
| − | + | [[git commit --no-verify]] | |
| + | == Examples == | ||
git commit -m "your message" | git commit -m "your message" | ||
[master (root-commit) 07e1897] PATH | [master (root-commit) 07e1897] PATH | ||
| Line 16: | Line 21: | ||
create mode 100644 file3.txt | create mode 100644 file3.txt | ||
| + | git commit -m "test" | ||
| + | On branch main | ||
| + | [[nothing to commit]], working tree clean | ||
| + | |||
| + | [[git commit --amend --reset-author]] | ||
| + | |||
| + | === git status=== | ||
[[git status]] | [[git status]] | ||
On branch master | On branch master | ||
| Line 21: | Line 33: | ||
git status | git status | ||
| − | On branch master | + | On branch [[master]] |
Untracked files: | Untracked files: | ||
(use "git add <file>..." to include in what will be committed) | (use "git add <file>..." to include in what will be committed) | ||
| Line 29: | Line 41: | ||
nothing added to commit but untracked files present (use "git add" to track) | nothing added to commit but untracked files present (use "git add" to track) | ||
| − | git status | + | [[git status]] |
On branch master | On branch master | ||
Changes to be committed: | Changes to be committed: | ||
| Line 36: | Line 48: | ||
new_file: file_you_forgot_to_commit.txt | new_file: file_you_forgot_to_commit.txt | ||
| + | |||
| + | git commit -m "my test" | ||
| + | On branch [[master]] | ||
| + | Your branch is based on '[[origin]]/master', but the upstream is gone. | ||
| + | (use "[[git branch --unset-upstream]]" to fixup) | ||
| + | |||
| + | nothing to commit, working tree clean | ||
== Related terms == | == Related terms == | ||
| + | * <code>[[git config --global --edit]]</code> | ||
| + | * <code>[[aws codepipeline]]</code> | ||
| + | * <code>[[git cz]]</code> | ||
| + | * <code>[[git remote add]]</code> | ||
| + | * <code>[[git commit --help]]</code> | ||
| + | * <code>[[git commit -an]]</code> | ||
| + | * <code>[[pre-commit]]</code> | ||
| + | * [[Signing commits]]: <code>[[git commit -S]]</code> | ||
| + | * <code>[[git log -1]]</code> | ||
| + | * List latest commits: <code>[[git log --oneline]]</code> | ||
| + | |||
| + | == Activities == | ||
* [[Make Local Changes and Update remote Repositories]] | * [[Make Local Changes and Update remote Repositories]] | ||
| + | * [[Creating a commit with multiple authors]] | ||
== See also == | == See also == | ||
* <code>[[docker container]] commit</code> | * <code>[[docker container]] commit</code> | ||
| − | * {{git}} | + | * {{git commit}} |
| − | |||
[[Category:git]] | [[Category:git]] | ||
Latest revision as of 19:15, 11 June 2025
Steps: git add -> git commit -> git push
Basic example[edit]
touch README.md git add README.md git commit -m "Creating README" git push -u origin master git commit -a git commit --no-verify
Examples[edit]
git commit -m "your message" [master (root-commit) 07e1897] PATH 3 files changed, 3 insertions(+) create mode 100644 file1.txt create mode 100644 file2.txt create mode 100644 file3.txt
git commit -m "test" On branch main nothing to commit, working tree clean
git commit --amend --reset-author
git status[edit]
git status On branch master nothing to commit, working tree clean
git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) file_you_forgot_to_add.txt nothing added to commit but untracked files present (use "git add" to track)
git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new_file: file_you_forgot_to_commit.txt
git commit -m "my test" On branch master Your branch is based on 'origin/master', but the upstream is gone. (use "git branch --unset-upstream" to fixup) nothing to commit, working tree clean
Related terms[edit]
git config --global --editaws codepipelinegit czgit remote addgit commit --helpgit commit -anpre-commit- Signing commits:
git commit -S git log -1- List latest commits:
git log --oneline
Activities[edit]
See also[edit]
docker container commitgit commit [ -a | -an | -am | --amend | --amend --reset-author | --no-verify | -m | -S ], Signing commits
Advertising: