开发者

Add new local directory to a git remote branch

开发者 https://www.devze.com 2023-02-09 12:19 出处:网络
I have a directory on my PC I\'d like to add to a particular branch in a remote git repo on my server. I have git, the branch was created fresh off the master from the server, but I\'ve got an entire

I have a directory on my PC I'd like to add to a particular branch in a remote git repo on my server. I have git, the branch was created fresh off the master from the server, but I've got an entire project with which I would like to use git.

What is 开发者_开发技巧the best way to go about this?


Clone the remote repository on to your PC.

git clone user@example.com:myproject.git

Checkout the branch to which you would like to add those files.

cd myproject

git checkout -b my_new_branch

Move the files into your project directory, then add & commit them.

git add .

git commit -m "new files for my new branch"

You'll probably want to push, too.

git push origin my_new_branch

0

精彩评论

暂无评论...
验证码 换一张
取 消