初始化

git init

添加跟踪

git add .

提交

git commit -m 'first commit'

# 临时使用其他账号提交
git commit --author="newname <[email protected]>" --message="new commit message" --date="2024-01-01 12:00:00"

关联远程仓库

git remote add origin [email protected]:XXX/XXX.git

取消关联

git remote remove origin

将项目推到Git仓库

git push -u origin master

克隆仓库

git clone [email protected]:XXX/XXX.git

修改仅用于本仓库的配置

cd path/to/repository

git config user.name "LinXueyuanStdio"
git config user.email "[email protected]"

修改用于所有仓库的配置

git config --global user.name "LinXueyuanStdio"
git config --global user.email "[email protected]"

修改上一个提交

git commit --amend --author="newname <[email protected]>"

# 如果这个修改已经被推送到云端,需要强制推送来生效
git push -f