Git And GitHub (Push, clone, Branch, Head, Merge, Pull Request)
Push
A Push is directly related to the commit. Because as you save your progress with commits, you need to have a way to share your work with your team, and here comes a Push. It syncs your local work with the remote repository of your project. You can easily push many commits at once, for example when you don’t have an internet connection, you can still work on your project, create many commits, and when you are back online, you push them all, for your team to see.
Clone
A clone is what the name suggests, literally a clone of your repository, it includes all information stored within the repo, all files, and the history of changes. It takes the remote repository and creates an exact copy of it on your local machine.
If you are into clone commands, there is a detailed article describing how to clone a Git repository, and what the pros and cons of such a solution are.
Branch
You can think of a branch as a safe place for you to work on your code, separately from the main project. This allows your team for safe work on the project because individual bugs and mistakes will only affect the branch you work on and won’t affect the main software stored on the Master Branch. We’ll take a closer look into how to commit changes to another branch later.
Head
While working with git, and using branches you need to know which branch you are working on currently, and that branch is called the “HEAD” branch and is sometimes referred to as an active or current branch.
Merge
When you think you finished work on your branch, added a new feature, and tested it you would like to include it into the main codebase – the Master branch, or into the branch that is higher in the hierarchy. You basically merge them together. From now on, the new code will be a part of the branch you merged to.
Fork
A Fork is something similar to the cloned repository. But there is a big difference, instead of cloning the repository on your local machine, a new repository with the same code is created and assigned to you – a fork. This feature is used usually when developers decide to try and go the other direction with the software that already exists, with different ideas to test them in a safe environment, so that the changes don’t influence the main code. You can also merge the changes to the master branch. To learn more, check this post – Git forking workflow.
Pull Request
A pull request is when you want to pull (merge) branches or forks with all of the changes made within them into the master branch. If the pull request is approved, all the changes made in the branches are now a part of the main software. There is also a possibility that the pull request will not be approved, then the person responsible for merging branches is able to give feedback on why it wasn’t possible, so you can improve and fix the code.
Comments
Post a Comment