1. git config (self not verified on organized web)
The git config configuration file used to configure git has three locations corresponding to different overrides.
(1), /etc/gitconfig file:
Include values that apply to all users and libraries of the system.If the parameter option'--system'is passed to git config, it will explicitly read and write the file.(
2).,~/.gitconfig file: specific to your users.
You can make Git read or write this specific file by passing the--global option.
3), config file located in Git directory (that is.git/config):
Whatever library you are currently using, point specifically to that single library.For example, if you are in the first git repository, it is a modification to the current git repository
* without any parameters or when --local
Note: Each level overrides the value of the previous level.Therefore, the value in.git/config will override ~/.git config, which will override in/etc/git config
The same value.When not, go to your superior and use it.
Common configurations:
The first thing you need to do when you install Git is set up your user name and e-mail address.This is important because the letter is used every time a Git submission is made
Info.It is permanently embedded in your submission:
$ git config --global user.name Joey
$ git config --global user.email zhaojoeyuan@163.com
For current users, when you want to use something special in a warehouse, you just need to set it up again without the--global s.
* See all current settings git config-l often:
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git config -l
\core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=D:/git/Windows/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=Joey
user.email=zhaojoeyuan@163.com
push.default=simple
core.editor=vi
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
......
There are also more common attributes such as:
--system, --global, --local--local: is the default.
git config [--global] options value
core.editor=gedit: Editor to set default
push.default=simple: used to set the default push mode
--get: used to get
git config --get core.editor
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git config --get core.editor
vi
git config --global --get user.name
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git config --get user.name
Joey
-- unset Delete: git config --unset user.name Delete a configuration
2,git cherry-pick.
Complete command: git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[<keyid>] <commit>...
git cherry-pick: Submit commits that have already been submitted again. Can be one or more.
Here I used a non-conflicting command to understand the command and created a new.txt file of my own
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ vi new.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
new.txt
nothing added to commit but untracked files present (use "git add" to track)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git add .
warning: LF will be replaced by CRLF in new.txt.
The file will have its original line endings in your working directory.
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git commit
[master 52d0d56] Joey : Test forcherry-pickCommand of Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha
warning: LF will be replaced by CRLF in new.txt.
The file will have its original line endings in your working directory.
1 file changed, 1 insertion(+)
create mode 100644 new.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git log
commit 52d0d56d7a70181672cbf78149f60a50ad93add9
Author: Joey <zhaojoeyuan@163.com>
Date: Tue Apr 18 20:38:29 2017 +0800
Joey :
Test forcherry-pickCommand of
Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha
commit dc67406bf27de952d792cde3f6387d12dcca7544
Author: Joey <zhaojoeyuan@163.com>
Date: Mon Apr 17 23:17:10 2017 +0800
checkout
After submitting, we switch to another branch, intending to put the previous submission cherry-pick on.
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git branch
joey/master
local
* master
new
next
test
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git checkout test
Switched to branch 'test'
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ ls
Test.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ git log -2
commit e4b44b46e2b55e07ef0b69f440a57ab72f666826
Author: zhaoJoeyuan <zhaojoeyuan@163.com>
Date: Mon Apr 17 22:38:52 2017 +0800
Update Test.txt
commit ee244d06b0221853e1711bb453d5bcaada488747
Author: zhaoJoeyuan <zhaojoeyuan@163.com>
Date: Mon Apr 17 22:32:24 2017 +0800
Update Test.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ git cherry-pick 52d0d56d7a70181672cbf78149f60a50ad93add9
[test 81dcaa7] Joey : Test forcherry-pickCommand of Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha
Date: Tue Apr 18 20:38:29 2017 +0800
1 file changed, 1 insertion(+)
create mode 100644 new.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ ls
new.txt Test.txt
If you don't know the previously submitted id, use git reflog to view it, here you can see that cherry-pick ing on the master branch succeeded.
Notice that commitid s are different and represent the only submission.You may also need to modify the submitted message information during actual development, so you
) Just use git commit --amend to modify it
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ git commit --amend
[test 70e1cdb] Joey : Test forcherry-pickCommand of Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha modifymessgaeinformation.
Date: Tue Apr 18 20:38:29 2017 +0800
1 file changed, 1 insertion(+)
create mode 100644 new.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ git log -2
commit 70e1cdb6b8ce366eb004d0e900e1e443089f96b2
Author: Joey <zhaojoeyuan@163.com>
Date: Tue Apr 18 20:38:29 2017 +0800
Joey :
Test forcherry-pickCommand of
Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha
modifymessgaeinformation.
You can also modify the author. Sometimes the current patch isn't you at work, so you need to change it. Note the format of the name.
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ git commit --amend --author="zhaoyuan <zy782234027@qq.com>"
[test 083f58f] Joey : Test forcherry-pickCommand of Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha modifymessgaeinformation.
Author: zhaoyuan <zy782234027@qq.com>
Date: Tue Apr 18 20:38:29 2017 +0800
1 file changed, 1 insertion(+)
create mode 100644 new.txt
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (test)
$ git log -2
commit 083f58fd2cce4310d041f575d9c80cb20511923a
Author: zhaoyuan <zy782234027@qq.com>
Date: Tue Apr 18 20:38:29 2017 +0800
Joey :
Test forcherry-pickCommand of
Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha
modifymessgaeinformation.
You can submit this push to a remote repository or gerrite once everything has been met.Resolve conflicts as usual when there are conflicts
You can.When a cherry-pick is executed, a new submission is generated.Git commit-c id: ID is cherry-pick ID.
git cherry-pick-x <commit id>: This cherry pick retains information about the original submitter, such as the original author.But don't know if commiter stays the same?
Be careful when you are actually working.
git fetch ssh://xp022430@review.sonyericsson.net:29418/platform/packages/apps/Nfc refs/changes/13/1788013/1 &&
git cherry-pick FETCH_HEAD: The command for cherry-pick copied from gerrite is as follows: fetch first, then submit fetch remotely
ID, cherr-pick to local.Then you see for yourself that you don't need to modify message information, author, and so on.Change it yourself.