Git basic operation @ Erwin | 2021-08-24T16:34:38+08:00 | 1 minute read | Update at 2023-12-06T00:27:08Z

Basic usage of git and github.

Global configuration:

git config --global user.name "your name"
git config --global user.email "you email"
git config --global core.filemode false           # ignore file mode changing
                                                  # 忽略文件权限等变化

Basic Usage:

git init                                          # 在当前目录初始化git repository
                                                  # initiate a git repository in current directory
git add --all                                     # 追踪当前目录下所有文件
                                                  # track all file in repository
git commit -m "xx"                                # 提交变化
                                                  # commit change
git remote add origin "remote repo"               # 添加远程仓库
                                                  # add remote repository
git branch -M master main                         # 分支master改名为main(github默认分支)
                                                  # rename this branch from master to main
git push -u origin master/main                    # 推送到远程仓库
                                                  # push data to remote repository
git log --pretty=format:"%s"                      # 查看commit记录
                                                  # check commit record
git submodule add <remote path> <local path>      # 添加子仓库
                                                  # add submodule

Pip install with git

pip install <url>
# example:
pip install -e git+https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.5.0/en_core_web_trf-3.5.0-py3-none-any.whl

pip install git+<git repo>@<branch or tag>
# example:
pip install git+https://github.com/erwinliyh/kylis_kit@main

© 2020 - 2024 Li Yuanhao's Blog

Powered by Hugo with theme Dream.

avatar

Li Yuanhao's BlogJust do it

Social Links