将本地项目文件夹推送到远端git仓库并同时创建新分支

当前状态:

我们有一个远程仓库和一个本地项目仓库,本地仓库没有配置 git。 现在想将本地仓库中的部分文件作为一个新的分支推送到远端仓库。

 

Procedures:

  1. Set up ".gitignore" file.
  2. "git init" in local repo.
  3. git checkout -b <new-branch>
  4. git add .
  5. git config --global user.email "you@example.com" (use --local if you only want this takes effect on this particular repo)
    git config --global user.name "Your Name"

  6. git commit -m "commit-msg"
  7. git remote add <remote-name> <remote-url> (usually the remote-name is set to 'origin')
  8. git push -u <remote-name> <new-branch>
posted @ 2021-06-30 17:15  略略略——  阅读(189)  评论(0编辑  收藏  举报