Tuesday, January 21, 2020

Git – commit. Creating snapshot



[root@oeldb repo]# git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test.txt
        new file:   test1.py
        new file:   test2.html

[root@oeldb repo]# git commit

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@oeldb.(none)')
[root@oeldb repo]#


[root@oeldb repo]# git config --global user.email "root@oeldb.com"
[root@oeldb repo]# git config --global user.name "rootuser"

Git commit with a message

[root@oeldb repo]# git commit -m "First Commit"
[master (root-commit) 338337c] First Commit
 3 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
 create mode 100644 test1.py
 create mode 100644 test2.html
[root@oeldb repo]#

List of all the tracked files :- use -a option

[root@oeldb repo]# git commit -a -m "First Commit"


To view the previous commits

[root@oeldb repo]# git log
commit 338337c67665a0a64bba46fb9b9efe1ebf0738f3
Author: rootuser <root@oeldb.com>
Date:   Thu Jan 16 18:00:10 2020 +0530

    First Commit
[root@oeldb repo]#

Author – the one who committed. Contributors.





No comments:

Post a Comment