[cmake-developers] pushing just a specific commit ?
brad.king at kitware.com
Tue Apr 20 17:37:36 EDT 2010
Alexander Neundorf wrote:
> I have two small commits in my local cmake git repository.
> Both are working, but I'd like to push only of them right now.
> I haven't found out how to do this.
> That's what I tried:
> File .git/COMMIT_EDITMSG saved
> [master 79963cf] -fix typo in HAS_CXX docs (#10578)
> 1 files changed, 1 insertions(+), 1 deletions(-)
> hammer:~/src/CMake/CMake-git/Source$ git push --dry-run 79963cf
> fatal: '79963cf' does not appear to be a git repository
> fatal: The remote end hung up unexpectedly
> hammer:~/src/CMake/CMake-git/Source$ git log
> The git-push man page wasn't very helpful either, the examples given there
> just deal with different branches, but not commits.
> Is it possible to push just specific commits ?
Create a local branch on which to work, starting at origin/master:
$ git fetch origin
$ git checkout -b temp origin/master
Cherry-pick the changes:
$ git cherry-pick <sha1-of-one-commit>
$ git cherry-pick <sha1-of-other-commit>
Push the new history:
$ git push origin 'temp:master'
Rebase your other work on it
$ git rebase temp master
This should automatically exclude the commits.
Then delete the temporary branch:
$ git branch -d temp
More information about the cmake-developers