# 创建一个新库

echo "# q" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M master
git remote add origin git@github.com:username/repo.git
git push -u origin master

# 推送本地已有库到远端

git remote add origin git@github.com:username/repo.git
git branch -M master
git push -u origin master

# 新建空分支

git checkout --orphan master
git add .
git commit -m "clear old commits"
git push --set-upstream origin master

# 删除分支

查看全部分支

git branch -a

删除远程分支

git push origin --delete <branch_name>

删除本地分支

git branch -d <branch_name> # 
git branch -D <branch_name> #

相同点:都是删除本地分支的方法(与删除远程分支命令相独立,要想本地和远程都删除,必须得运行两个命令)。
不同点:前者会在删除前检查 merge 状态(其与上游分支或者与 head),后者是 git branch --delete --force 的简写,它会直接删除。

# DVC 管理数据

# 创建新仓库

# 1. 初始化 Git 仓库

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://dagshub.com/username/repo.git
git push -u origin master
Username: username
Password: token

# 2. 初始化 DVC 项目并跟踪数据

touch DATAFILE.md
dvc init
dvc add DATAFILE.md
dvc remote add origin https://dagshub.com/username/repo.dvc
dvc remote modify origin --local auth basic
dvc remote modify origin --local user username
dvc remote modify origin --local password token
git add .
git commit -m "first data file"
git push
dvc push -r origin  # 确保 DVC 版本 `>= 1.10`

# 推送现有存储库

git remote add origin https://dagshub.com/username/repo.git
git push -u origin master
Username: username
Password: token

# 推送现有数据

dvc remote add origin https://dagshub.com/username/repo.dvc
dvc remote modify origin --local auth basic
dvc remote modify origin --local user username
dvc remote modify origin --local password token
dvc push -r origin  # 确保 DVC 版本 `>= 1.10`