Difference between revisions of "Git commit"

From wikieduonline
Jump to navigation Jump to search
 
(14 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
Steps: <code>[[git add]]</code> -> <code>[[git commit]]</code> -> <code>[[git push]]</code>
 
Steps: <code>[[git add]]</code> -> <code>[[git commit]]</code> -> <code>[[git push]]</code>
  
 +
* <code>[[git commit --help]]</code>
  
==Basic commands==
+
== Basic example ==
* <code>touch README.md</code>
+
[[touch]] README[[.md]]
* <code>[[git add]] README.md</code>
+
[[git add]] README.md
* <code>git commit -m "Creating README"</code>
+
git commit -m "Creating README"
* <code>[[git push -u origin master]]</code>
+
[[git push -u origin master]]
* <code>[[git commit -a]]</code>
+
[[git commit -a]]
* <code>[[git commit --no-verify]]</code>
+
[[git commit --no-verify]]
  
 
== Examples ==
 
== Examples ==
Line 22: Line 23:
 
  git commit -m "test"
 
  git commit -m "test"
 
  On branch main
 
  On branch main
  nothing to commit, working tree clean
+
  [[nothing to commit]], working tree clean
  
 
  [[git commit --amend --reset-author]]
 
  [[git commit --amend --reset-author]]
  
=== Status===
+
=== git status===
 
  [[git status]]
 
  [[git status]]
 
  On branch master
 
  On branch master
Line 56: Line 57:
  
 
== Related terms ==
 
== Related terms ==
* [[Make Local Changes and Update remote Repositories]]
 
 
* <code>[[git config --global --edit]]</code>
 
* <code>[[git config --global --edit]]</code>
 
* <code>[[aws codepipeline]]</code>
 
* <code>[[aws codepipeline]]</code>
 
* <code>[[git cz]]</code>
 
* <code>[[git cz]]</code>
 
* <code>[[git remote add]]</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>
 +
 +
== Activities ==
 +
* [[Make Local Changes and Update remote Repositories]]
  
 
== See also ==
 
== See also ==
 
* <code>[[docker container]] commit</code>
 
* <code>[[docker container]] commit</code>
 +
* {{git commit}}
 
* {{git}}
 
* {{git}}
  
 
[[Category:git]]
 
[[Category:git]]

Latest revision as of 16:49, 20 September 2024

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]

Activities[edit]

See also[edit]

Advertising: