git merge –no-commit vs git cherry-pick –no-commit

Is there any difference between git merge --no-commit and git cherry-pick --no-commit?

And is there any difference in history if I commit after these two commands?

  • How to swap the content of a file in the working directory with the content of a previously staged version of this file?
  • How to cherry-pick the last sha from another branch in Git with 1 command?
  • What's the -practical- difference between a Bare and non-Bare repository?
  • Adding git branch on the Bash command prompt
  • What are the difference between these 3 .gitignore entries?
  • Why does git sometimes mark added lines as changed lines (i.e. an empty conflict over an added piece of code)
  • Create a patch by comparing a specific branch on the remote with a specific local branch
  • Getting Gogs/Github to auto-deploy to Dokku/Heroku on commit
  • Git diff between two tags with username
  • How to have multiple pods in one git repo
  • How to organize different parts of project in git repo?
  • How do I get the Maven Release Plugin to work with Git over SSH?
  • 2 Solutions collect form web for “git merge –no-commit vs git cherry-pick –no-commit”

    If you commit after git merge --no-commit, you’ll actually get a merge commit. Whereas after a git cherry-pick --no-commit you’ll get a commit with a single parent.

    Hence, yes, there is a difference between those two commands.

    In particular if you have something like

    A -- B -- C
     \        L HEAD
      \
       -- D -- E
    

    If you cherry-pick commit E, you won’t get modifications of commit D. Whereas if you merge, you’ll get both.

    While git-merge is used to join two or more development histories together, git-cherry-pick is used to apply changes introduced by some existing commits.

    So then, once you commit after performing a git-merge, Git will add what’s called a merge commit. In the other side, when cherry-pick(ing) commits, git will apply the changes introduced by these commits on the top of your working tree (There’s no fusion between two or many branches). Put another way, Commits are cloned and put on top of your branch.

    Take a look at Git Cherry-pick vs Merge Workflow to undestand the differences based on a repo maintainer real needs.

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