Push only last commit with TortoiseGit

I want to push only the last commit with TortoiseGit to a sourceforge repository. All previous ones shall not be pushed. Here is was said I can create a new branch and push this one. But the new branch has all previous commits and not only the last one.

What am I doing wrong?

  • Undoing an old commit
  • Build on commit with subversion
  • How do I edit past git commits to remove my password from the commit logs?
  • How do I get all refs that point to a commit in git?
  • How can I change code within a commit to help find a bug?
  • One-Time Git Commit using Filesystem Created as Author Date
  • Thanks!

  • Using git, how do you move some uncommitted changes from one branch to another branch in a different folder?
  • How to check out a specific tag with Egit?
  • How to work wit Git correctly?
  • View differences of branches with meld?
  • Workflow for handling pull requests in a gitflow workflow (with infrequent releases)?
  • Why do I get different results in git bash (msysgit) and git in cygwin?
  • One Solution collect form web for “Push only last commit with TortoiseGit”

    I think this is primarily a misunderstanding of how git works. When you push a commit, if that commit has a parent, git will make sure that that parent is in the remote repository as well. Aside from sparse clones (which may be useful for preserving bandwidth and/or disk usage, but impose some restrictions on how you can interact with remote repositories), git is designed to keep the object database complete and consistent. Completeness/consistency would be violated if you could push a commit without it’s parents being in the repository as well. So, by design, you can’t just push one single commit without git making sure that commits lineage is preserved.

    That said, there are two specific ways you can arrange to only push a single commit: 1) make sure that the parent of the commit you want to push is already in the remote database (e.g. use rebase to squash all commits on the branch down to a single commit, and possibly relocate that branch if necessary – but that may not be the best choice for your workflow), or 2) make sure that the commit you want to push has no parents – e.g. git checkout -b somebranch --orphan in recent versions of git, then create your commit.

    Git Baby is a git and github fan, let's start git clone.