

Reset Your Branch Git resetĪnother one of the advanced Git features can be used to reset your branch, revert, or rewind to the last commit. This command is useful whenever you need an independent branch without any relation to any other available branches. It can be accomplished by using the Git checkout command with the ––orphan option. So the first commit in this branch will be the root of this branch without having any history. An orphan branch is a separate branch that starts with a different root commit.

If you want to share your branch with someone else with no history, you can do that by creating an orphan branch. This command is useful to fetch the required branch quickly to fix the issues in a big project. You need to mention the name of the branch, such as staging or development, and the path of the Gitlab or Github repo. To fetch a specific branch’s content, you need to trigger the same Git clone command along with the branch name you want to clone. Cloning a Specific BranchĪs mentioned in the previous blog, an existing repo can be cloned using the Git clone command, but what if you need to clone only a specific branch of the repo? For example, if you have master, staging, and development branches, you may just want to clone the staging branch.
#Github desktop cherry pick code#
Often we ask questions like: What are the differences in our code files and branches? How do we download a piece of code? How can we merge changes to remote? This blog will help you answer these questions and provide you a brief summary of some advanced Git features. In general, we mostly use the basic Git commands in projects, like Git clone, Git pull, Git checkout, Git add and Git commit, although in some cases we need advanced Git features to check our work. This is one of the most important parts of our daily work. At Rubico, we use Git to manage our source code.
