text 将git添加到git初始化的本地文件夹

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 将git添加到git初始化的本地文件夹相关的知识,希望对你有一定的参考价值。

I would commit your working directory to ensure that it exists in history before fetching. (ensure you are in the projects root folder)

git init
git add -A
git commit -m "my latest'
now we have it

git remote add origin url-to-your-remote
git fetch origin
now we have the history from the remote

git reset origin/master
now our current commit is the latest from the remote

git add -A
git commit -m "Committed my state"
now we use our current working directory as the snapshot for the next commit.

git push -u origin master
push up your changes and track the branch.

the key is the reset command with no --hard option. It keeps your working folder the same while pointing the branch to what you got from the remote.

以上是关于text 将git添加到git初始化的本地文件夹的主要内容,如果未能解决你的问题,请参考以下文章

使用git将本地仓库同步到github远程仓库

07-git-上传本地项目到仓库

text 将远程添加到本地git项目

Git的初始化以及本地仓库文件的创建修改和删除

git将本地项目上传到远程仓库

将本地项目上传到远程Git服务器