Reputation: 163
I have an existing repository in Github. But how do I commit changes and push the files to a particular directory in that repository?
Note - I've done all the steps from git remote add origin
to 'git commit' to 'git push` but, how do I select that particular directory I want to push changes into the repository from the terminal.
PS - I want to push changes from my local [which is not in my project directory] to a particular existing Directory of the Repository.
Upvotes: 1
Views: 706
Reputation: 1323263
Suppose I've created some files in a temp local directory [which is not in my project directory for some reasons] and I wanna push the files inside the temp folder to a pre-existing directory of my repository using git remote add. I
First, git remote add
is just to declare a remote URL: it does not add or push any file.
Second, simply copy those file in the local repository, with the right folder.
Then:
git add theRightFolder
git commit -m "Add theRightFolder content"
git push -u origin master
If that folder includes other files you do not want to push, you will need to git add only the files you have copied
git add theRightFolder/file1
...
git add theRightFolder/filen
git commit -m "Add some files in theRightFolder"
git push -u origin master
Upvotes: 1