Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

git - Pushing only one folder to remote repo

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...