0

I wanted to make a new branch production and copy only one latest commit from current branch develop to new branch production. I created and checked out the branch with command git checkout -b production. But when I review the commits with git log in production branch than instead of getting 0 commits I'm getting all commits from the develop branch. I only want one latest commit from develop branch and I don't know how to achieve it. Can anybody help me with it?

Thanks.

Mayank Kataria
  • 680
  • 1
  • 9
  • 18

1 Answers1

2

By default, new branch is created from the last commit from current branch. Try this (Specify the commit which you want as the HEAD in the new branch):

git checkout -b <new-branch-name> <your-commit-id>
Sabareesh
  • 671
  • 6
  • 13