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. Checkout the branch to which you would like to add those files. Move the files into your project directory, then add & commit them. git add .
To add a specific directory in git, you can use the git add command followed by the directory's name. Start by creating a new directory in the sample_repo. The command above will only add the specified and ignore other untracked files.
Clone the remote repository on to your PC.
git clone [email protected]: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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With