zl程序教程

您现在的位置是:首页 >  工具

当前栏目

[GitHub] 1. Configuring Git

GitHubGit Configuring
2023-09-14 08:59:21 时间

1.2 Configuring Git

Here's a list of some configuration options we just went over with one part of the git command missing. Make sure your own git configuration is setup the way you want it by selecting any of these commands you find useful.

To check your current username:

$ git config --global user.name

To set your username:

$ git config --global user.name "Beatrix Kiddo"

To check your email:

$ git config --global user.email

To set your email:

$ git config --global user.email beatrix@deadly-vipers.com

To limit pushes to your current branch:

$ git config --global push.default simple

To default all new branches to fetch and rebase - not merge:

$ git config --global branch.autosetuprebase always

To record any merge conflict resolutions and reuse them automatically:

$ git config --global rerere.enabled true

To colorize git’s output for increased readability:

$ git config --global color.ui true

To create a git s alias:

$ git config --global alias.s "status -s"

To create a git lg alias:

$ git config --global alias.lg "log --oneline --decorate --all --graph"

To configure line endings correctly on Linux/Mac:

$ git config --global core.autocrlf input

To configure line endings correctly on Windows:

$ git config --global core.autocrlf true

 

Alisa Setting: 

git config --global alias.s "status -s"
// git s

git config --global alias.lg "log --online --decorate --all --graph"
// git lg

 

1.4 Fork

Fork the repo which You DONNOT have premittion to push you commit.

Basic, you copy the repo to your local and then push commit to your forked repo.

 

1.5 Create a Pull Request:

If want to push the changes to the owner's repo, then you can send a pull request.

Owner will review the pull request, if he accepts, then the changes will be updated.

If he doesn't approve it, he will send back the msg, we do the change accordingly, then push changes to our repo again. 

At the same time, it will automaticlly send the request to the own's repo, notify him we have done the changes.

 

 

1.8 Add Upstream 

We really want to contribute to the "deadlyvipers/dojo_rules" repository long term. In the console, add this repo, https://github.com/deadlyvipers/dojo_rules.git, as a remote named upstream.

$ git remote add upstream https://github.com/deadlyvipers/dojo_rules.git

 

1.9 Staying Up To Date 

Now that we have the remote added as upstream, go ahead and merge all changes on from the master branch of the "deadlyvipers/dojo_rules" repository into your local master branch.

$ git remote add upstream https://github.com/deadlyvipers/dojo_rules.git
$ git fetch upstream
$ git merge upstream/master master