markdown 有用的git命令和配置。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 有用的git命令和配置。相关的知识,希望对你有一定的参考价值。

# Useful git Command and Configuration

Simple cheatsheet

## Clone, init, add, commit

- If clone `$ git clone [url]`
- Initialize directory `$ git init`
- Add files `$ git add .` will add current directory
- To commit use `$ git commit -m"[commit message]"`
- Add and commit `$ git commit -am "[commit message]"`

## Collaborate

- Show remote -details `$git remote -v`

## To globally ignore specific folder file type

**Example** : Ignore `.DS_Store`, `.vscode` and `vendor` globally
- Create global gitignore somewhere eg: `~/.gitignore_global`
- Insert ignored pattern in that file
- Set git to globally use the file

``` bash
$ touch ~/.gitignore_global
$ echo .DS_Store >> ~/.gitignore_global
$ echo .vscode >> ~/.gitignore_global
$ echo vendor >> ~/.gitignore_global
$ git config --global core.excludesfile ~/.gitignore_global
```
Reference :
- https://stackoverflow.com/questions/18393498/gitignore-all-the-ds-store-files-in-every-folder-and-subfolder
- https://help.github.com/articles/ignoring-files/


## References

- Github git cheatsheet https://services.github.com/on-demand/downloads/github-git-cheat-sheet/

以上是关于markdown 有用的git命令和配置。的主要内容,如果未能解决你的问题,请参考以下文章

markdown git有用的命令

markdown Git有用的命令

markdown Git - 有用的命令

markdown 有用的Git命令

markdown 有用的Git命令

markdown 有用的Git命令