I'm using Git 1.7.4.1. I want to push commits I did on one folder to my remote repo. How do I push only changes from one folder to my remote repo? All the documentation I've found only lists how to push the entire repo ...
davea-mbp2:systems davea$ git push origin trunk
Password:
To http://[email protected]/systems.git
! [rejected] trunk -> trunk (non-fast-forward)
error: failed to push some refs to 'http://[email protected]/systems.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
The conflicts I'm being warned about do not apply to the folder that I want to push. Any help is appreciated, - Dave
Open Git Bash in that particular folder that you want to push. Type git remote add origin PASTE_SSH_KEY_OF_CREATED_REPO. Then type git push origin master –force (type 'main' in place of the 'master' if your default branch is master).
Git works by pushing entire commits. Either rebase interactively to isolate your changes to the directory you are interested in., or make a submodule for it.
Git is not like subversion. The short answer is, you can't.
You should consider rebasing your change (only the one relevant) against the remote
git rebase -i origin/trunk
should get you underway. Be sure to read the comments and instructions along the way. There is also man git-rebase
of course.
In the end, when you are satisfied with the result, you can either create a new branch from there
git checkout -b rebased HEAD
or you can opt to make it your new master. I'll leave it up to you how to manage your branches locally (because you didn't tell us about them).
Pushing woud then be easy with
git push origin trunk
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