網頁

2020年3月2日 星期一

git 學習筆記 1

參考書 Git - Book

mark@mark-z390-u:~/Data/git_test$ mkdir sample; cd sample
mark@mark-z390-u:~/Data/git_test/sample$ git init
Initialized empty Git repository in /home/mark/Data/git_test/sample/.git/
mark@mark-z390-u:~/Data/git_test/sample$ ls -al
total 12
drwxrwxr-x 3 mark mark 4096 Feb 29 10:06 .
drwxrwxr-x 3 mark mark 4096 Feb 29 10:05 ..
drwxrwxr-x 7 mark mark 4096 Feb 29 10:06 .git
mark@mark-z390-u:~/Data/git_test/sample$ vim README.md
mark@mark-z390-u:~/Data/git_test/sample$ git add README.md
mark@mark-z390-u:~/Data/git_test/sample$ 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 'mark@mark-z390-u.(none)')
mark@mark-z390-u:~/Data/git_test/sample$ git config --global user.email "mark@mark-z390-u"
mark@mark-z390-u:~/Data/git_test/sample$ git config --global user.name "mark"
mark@mark-z390-u:~/Data/git_test/sample$ git config --global core.editor vim
mark@mark-z390-u:~/Data/git_test/sample$ git config --global merge.tool vimdiff
mark@mark-z390-u:~/Data/git_test/sample$ git config --global color.ui true
mark@mark-z390-u:~/Data/git_test/sample$ git config --global alias.st status
mark@mark-z390-u:~/Data/git_test/sample$ git st
On branch master

No commits yet

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

new file:   README.md

mark@mark-z390-u:~/Data/git_test/sample$ 
mark@mark-z390-u:~/Data/git_test/sample$ git config --list --show-origin
file:/home/mark/.gitconfig      user.email=mark@mark-z390-u
file:/home/mark/.gitconfig      user.name=mark
file:/home/mark/.gitconfig      core.editor=vim
file:/home/mark/.gitconfig      merge.tool=vimdiff
file:/home/mark/.gitconfig      color.ui=true
file:/home/mark/.gitconfig      alias.st=status
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
mark@mark-z390-u:~/Data/git_test/sample$ cat ~/.gitconfig 
[user]
email = mark@mark-z390-u
name = mark
[core]
editor = vim
[merge]
tool = vimdiff
[color]
ui = true
[alias]
st = status
mark@mark-z390-u:~/Data/git_test/sample$ 

沒有留言:

張貼留言