Some Essential Git Commands and their usage in GitHub Workflow
https://github.com/SvanBoxel/release-based-workflow/issues/1

Some Essential Git Commands and their usage in GitHub Workflow

What is Git?

There are some common tasks in each project during its development. We usually define and create new projects, work alone or in collaboration with others, test them, fix the errors, assess the changes done by others, and merge them.

In the traditional workflow, all these tasks may produce lots of redundancy, but the Git and GitHub have provided a new perspective in this area. If you are working alone on a project or with a team, or if your teammates are from the similar time zone or spread all over the world, Git and GitHub are the best options for managing the project progression!

Any project has a mainstream from which any contributors, branch out specific branches to apply their ideas on. After that if they are confident enough they could share their contribution to the mainstream and if the administrator of the project approves their changes, they will merge the sub-branches with the mainstream! Also, in the development process, you may need to recover or have access to any previous versions, save the changes in any points, put some notes about the changes and so on, multiple times!

In fact, the Git commands help to take some snapshots during the development process of the project. We will shape the history of the project by putting the snapshots next to each other. This history helps to track every piece of changes if it has a reasonable reason or not, decide to keep the changes or not, ask for extra information from the contributors, and do the merge!

Basic Git Commands

There are some essential Git commands to save the interaction in and between local branch and remote one:

No alt text provided for this image

Git Init: this command creates a hidden folder for keeping hidden data structure of the working place.

Git Clone: this command copies a full version of a remote project which already exists on the remote server.

Git Add: this command is the first part of taking snapshots. It stages the changes. Every staging is a part of the next snapshot and then part of the history of the changes.

Git Commit: this is the second part of taking snapshots. With this command, we can put this snapshot in the history of the project. Anything staged by the [git add] will be the part of the snapshot with git commit.

Git status: when we work in a special place, we may create, add or remove different files. Or even change the contents of the files. This command shows the untracked, modified or staged files in the workplace.

Git branch: shows the list of local branches we are working on.

Git merge: this command helps to merge the local branch, which is approved by the administrator of the project with the main branch.

Git pull: if you want to get the reflection of the other remote collaborators’ commits on the local branch, you have to use this command.

Git push: if you want to reflect the changes you have done on your branch, you reflect them with this command.

GitHub Work Flow

GitHub is the combination of the Git commands (as a distributed version control system) in the Hub as a conjunction of contributors and projects. In this picture, we see the workflow of contribution in the GitHub repository. GitHub uses the Git commands described in the previous section to keep the track of changes.

Using the GitHub flow, we create a new branch of a remote repository, add some commits as snapshots, open a pull request to share our changes or get some help, the collaborators may comment on our changes, test and review the pull request in the discuss and review code stage, then if the changes were reasonable they would be merged.

No alt text provided for this image


Note: Most of the contents of this article is adapted from the GitHub handbook from this address: https://guides.github.com/introduction/git-handbook/.

要查看或添加评论,请登录

Elahe Dorani的更多文章

  • What's new in C# 8.0?

    What's new in C# 8.0?

    Introduction C# as a type-safe, object-oriented and component-oriented programming language is at the heart of the .Net…

  • What's new in C# 7.0 through 7.3?

    What's new in C# 7.0 through 7.3?

    Introduction In C# version 7.0 which is released within Visual Studio 2017, we are facing some newer and cooler…

  • What is new in C# 6.0?

    What is new in C# 6.0?

    In the 6.0 version of the C# programming language, the main focus of language designers were on adding some features to…

    1 条评论
  • Chapter 18: Asynchronous Language Features

    Chapter 18: Asynchronous Language Features

    Introduction The CPU of digital gadgets are the brain of devices. The operating systems on them would consider an…

    1 条评论
  • Chapter 10: LINQ

    Chapter 10: LINQ

    Introduction LINQ, the Language Integrated Query, is an integrated set of technologies using to apply some queries on…

    3 条评论
  • Chapter 9: Delegates, Lambdas, and Events

    Chapter 9: Delegates, Lambdas, and Events

    Introduction Delegates are some types that provide a reference to the methods. Events are some notification occurred in…

  • Chapter 8: Exceptions

    Chapter 8: Exceptions

    Introduction In the execution process of any programs, there could occur some errors and it is on the CLR decide to run…

  • Garbage Collection

    Garbage Collection

    The garbage collector is an automatic mechanism to detect and collect the dead object’s memory space and make it…

  • Chapter 7: Object Lifetime

    Chapter 7: Object Lifetime

    Introduction C# language programming supports the object-oriented paradigm. It means that almost all operations in this…

  • Chapter 6: Inheritance

    Chapter 6: Inheritance

    C# as an object-oriented language has some essential features which make it possible to produce object-oriented…

社区洞察

其他会员也浏览了