huoxiangdong / Blog

学习记录
0 stars 0 forks source link

Git #72

Open huoxiangdong opened 6 years ago

huoxiangdong commented 6 years ago
 #初始化仓库
 git init  
 #添加文件到本地仓库
 git add .
 #添加文件到本地仓库
 git commit -m "first commit"  
 #远程仓库地址  #链接远程仓库,创建主分支
 git remote add origin + 
 #把本地仓库的变化连接到远程仓库主分支
 git pull origin master 
 #把本地仓库的文件推送到远程仓库
 git push -u origin master 
huoxiangdong commented 6 years ago

# fatal: refusing to merge unrelated histories
git pull origin master --allow-unrelated-histories
# error: failed to push some refs to
git pull origin master
git push -u origin master
#Found a swap file by the name ".git/.MERGE_MSG.swp”"
找到.git/.MERGE_MSG.swp这个文件删除即可 
huoxiangdong commented 6 years ago

更换仓库


git remote remove origin
git remote add origin [new_remote_repository_address]
git push origin master