How To Push Specific Commit/Commits To Git Remote without commands? | All you need to know
What is meant by Pushing Specific Commits To Git Remote?
Let me take an example to explain "Pushing specific commits to Git Remote".
Above figure shows the history of a branch called "master". In this history you can see different commits out there. Out of those we want to maintain a separate branch in the remote with the commits highlighted in the above figure.
Why do we need it?
Simple reason why we need a separate branch in the remote with the specific commits may be that these commits are associated with a different feature that we are trying to develop and accidently it became part of the main branch. Therefore afterwards if we want to maintain or organize the commits based on different features we may need to group the commits belonging to a specific feature and push it to the Git Remote.
How to Select and Push Specific Commits to Git Remote?
Steps:
- Create a new local branch based on the parent commit "Add .gitignore and .gitattributes"
Right click on the selected commit and click on "New branch" option, Give
the new branch a appropriate name as shown in the figures below:
- Once its done we can checkout the new branch created and see the history of that branch. It will be as shown in the figure below:
- Right click on the commits that we want to separate and include in the new branch created, in the Hierarchical order and click on Cherry-Pick as shown in the figure below:
- Once all the commits are cherrypicked we can see those in the new branch created as shown in the figure below:
Comments
Post a Comment