Home » Git Tutorial » Understanding Git Workflow

Understanding Git Workflow


Reading Time - 4 mins

As discussed earlier, Git is a set of tools which is used to manage code at GitHub Repository. So, we will be required to create a repository at first, where all our source code will be stored to be able to manage it.

But before this, we must have a visual idea about how git works.
Presented you below a diagrammatical representation to understand things better, and develop a good understanding of using git.

Git – General Workflow
1.) Creation of a new repository for a project at github.com, which stores all our source code.
2.) In our local machine, which has git Installed, we make our skeleton project folder, say (simple-web-app) as a git managed folder.
(If you already have a fully-fledged project code, you still can initialize it as a git project to be able to manage it with git.)
3.) We upload/push our code to the freshly created repository.
4.) Once, the code is hosted on GitHub Server, we can copy /Clone it in different machine, make changes in different machine, submit changes and merge them all together.

Git Workflow Diagram

  • As the above diagram illustrates, the skeleton project folder says simple-web-app folder containing just a simple HTML page(index.html) with no feature is initialized as a git project first.
  • After that we create a sample repository at github.com with the same or different project name say simple-web-app
  • Each repository we create a GitHub is recognized by its distinct URL.
    e.g. https://github.com/apache/spark which is used as a reference to upload our local skeleton project to the GitHub repository.
  • After the skeleton code is uploaded/pushed, we can clone the project into n number of machines, make some changes and submit it back to the skeleton project to make it complete.
    Say developer A can work on Machine A on feature#1 (say adding a Heading), developer B can work on Machine B on feature#2 (say adding a paragraph about the heading)
    When done, both can merge their code into the repository to make it a complete project.
READ  What is Git

Conclusion
Easy as it sounds, git has a number of useful commands on how we can manage, work on different features, add/remove code, use these codes at GitHub server to create a fresh release/version etc. and that’s what git is all about, which will be covered in the subsequent article. Once you learn using git, programming becomes much simpler, because you have a backup of every little thing that you made changes to and you can restore it, when it doesn’t seem to work, Stay Tuned.

Array Interview Questions
Graph Interview Questions
LinkedList Interview Questions
String Interview Questions
Tree Interview Questions