Introduction
In my previous
article, we discussed the steps of owner added files using git bash in the main branch in-depth and how to clone the uploaded project of GitHub repo for testing purposes. In this real-time series of articles, we discuss steps to push, pull and clone repository files to GitHub by team members using Git Bash under Organization. Here one member will add reviewers to review its pushed files by creating a pull request. In one scenario, the reviewer finds the issue or unwanted files and information to the user by adding comments on that particular pull request. After solving these issues by the user, the user again pushes the changes, creates a pull request for the latest changes, and then it will be merged to the main branch.
Today, I will describe the below-mentioned points in detail,
- satyaCsgithub member will identify account using author identity
- satyaCsgithub member will clone the GitHub project and create a new branch
- satyaCsgithub member will open and modify the GitHub project
- satyaCsgithub member will add, commit and push the changes to the GitHub repo
- satyaCsgithub member will create a pull request for the latest changes
- The owner will review these changes and ask satyaCsgithub member to fix the issue
- satyaCsgithub member will fix the issue and follow the above steps (1 to 5) in sequence
- The owner again will review these changes
- Finally, the branch of satyaCsgithub member will merge to the main branch for production deployment
- The owner will pull the changes in local git from GitHub repo as made by satyaCsgithub member
Note
Before going through this session, please visit my below-mentioned sessions related to Git and GitHub,
- Introduction To Git
- Steps For Configuring Git With Details
- Let's Know About Git Add, Git Commit, Git Status, And Git Push-In Details
- Let's Understand How Git Maintains History Of Version Or Commit Ids With Details
- Steps To Initialize A Git Repository And Push The Changes To GitHub In Details
- Let's Know About Git Branches And How To Implement It
- Let's Understand About Git Branches And Its Real-Time Uses
- Let's Learn About Merging The Git Branches And Create Pull Request In Details
- Steps To Ignore Files Using Gitignore In Details
- Let's Learn About Git Default Branch In Detail
- Steps To Create And Configure Organizations In GitHub In Details
- Let's Learn About GitHub Projects In Detail
- Let's Know About Team In GitHub In Details
- Managing Files On GitHub In Real-Time - Owner Uploads Project In GitHub Repo
Identify account using author identity
Here we login as a satyaCsgithub member and can see the repo with the .NET health care project as shown below,
Here the satyaCsgithub member will create a local directory and mention his User Email and User Name of GitHub account for author identity using Git Bash as shown below,
satyaCsgithub will clone the GitHub project and create a new branch
Now clone the project from a repo in the local git as shown below,
Here we change the directory to GitHub repo folder and check the default branch associated with the GitHub repo in local as shown below,
Next, create a new branch for satyaCsgithub member called satyaCsgithub_BranchRepo in the local git repository and make satyaCsgithub_BranchRepo as a current working branch or active branch instead of the main branch in my local git repository as shown below,
satyaCsgithub member will open and modify the GitHub project
Now open the solution (.sln) using visual studio as shown below,
Now we can see the local Git repo and the default branch as created earlier as shown below,
Then run the project to check the output as shown below,
Now open the index.html and modify the header content of the web application from Welcome to Satya Org Global Health Care to Welcome to Satya Org Global Health Care 2021 and check the output as shown below,
The output is shown below,
Now we check the status of these changes using Git Bash and Visual Studio as shown below,
Using Visual Studio the file index.html is shown as a red tick mark as shown below,
Now we check the history section where the project is modified by which GitHub users as shown below. As of now we can see the changes in the GitHub repo made by the owner called Infosatya with commit ID and commit message as shown below,
Now we can compare the changes of index.html as shown below,
Now, we change the directory to WebApplication1 of the GitHub repo folder as shown below,
Check the status using Git Bash and we can see the modified file name index.html as shown below. Here we can see other files which are auto-generated while building the solution. So, we need to ignore these files.
Here the existing file called index.html changes is not committed to the staging area and we can see the list of files under this local repo path as shown below,
satyaCsgithub member will add, commit and push the changes
Here the member adds the changes of index.html to the staging area as shown below,
If I check the status then see the result as already ready to be committed to the staging area and not committed files are shown below,
Then commit those changes to the staging area using the command as shown below,
Then push those files from local git to GitHub repository using the command as shown below,
Now, we can see the update in the View History section after pushing the changes using Visual Studio as shown below,
After successfully pushing these changes to the GitHub repo my new branch called satyaCsgithub_BranchRepo will be shown with the modified file in the GitHub repo as shown below,
Here we can see the new branch created by members in the GitHub repo as shown in the branch list.
After selection of branch, we can see the changes with commit message as shown below,
The commit changes of index.html file as shown below,
But in the same file if we check under the selection of the main branch then these changes are not available as shown below,
satyaCsgithub member will create a pull request for the latest changes
Click the Pull Request option as shown below,
Then create a pull request with details as shown below,
Here you get an interface as shown below after creating the pull request.
In pull request, we can check if the before changes and after changes of index.html need to be merged under the Files changed option.
Under the Commits section, we can check the user name who commits with added comments as shown below,
Here the member will add the Reviewers to review the changes under this pull request as shown below. Here we can request up to 15 reviewers. So, here the member added the owner as of the Reviewer.
After adding the Reviewer the interface will be shown as below,
InfoSatya was requested for review as shown below,
Here the owner called InfoSatya will get a mail that @satyaCsgithub requested your review on #1 Year added in header section as shown below. Here #1 is a link navigate to the pull request URL created by satyaCsgithub member i.e. https://github.com/SatyaOrgGlobal/HealthCare-Proj/pull/1
The owner will review these changes and ask satyaCsgithub member to fix the issue
Here the owner InfoSatya will login to his GitHub account and review the changes of satyaCsgithub using the pull request URL as described earlier.
Then the Reviewer will check the index.html file and its changes under the Files changed section.
After adding the review by Reviewer the interface is shown below,
Here we check the comments added by the Reviewer to make changes in the index.html file as shown below,
Here we can see the changes are requested as shown below,
satyaCsgithub member will check the comment of the Reviewer and fix the issue
Here the satyaCsgithub member will get the mail about the changes requested by the Reviewer as shown below,
Now the member called satyaCsgithub will login and check the changes requested by the Reviewer as shown below,
Here, I will make changes in the index.html file in the header section as per changes requested by the owner as shown below,
Now check the status as shown below,
Here the member added the changes of index.html to the staging area as shown below,
If I check the status then see the result as already ready to be committed to the staging area and not committed files are shown below,
Then commit those changes to the staging area using the command as shown below,
Then push those files from local git to GitHub repository using the command as shown below,
Now, we can see the update in the View History section after pushing the changes using Visual Studio as shown below,
Now check the GitHub repo as shown for the latest changes as shown below,
Now check the index.html file changes made in GitHub repo as shown below,
Now check our existing pull request for these new changes as shown below. Click on Compare link.
So, we check the code status with commit changes as shown below,
Now we check the pull request URL to check the updated commit status as shown below,
Now add the Reviewer again as shown below,
The owner again will review these changes
Now the owner will check mail as shown below,
Now the owner will login and check the pull request to review the changes under the Files changed section as shown below,
Then owner adds the comment as shown below,
Now check the interface with reviewed status as shown below,
Branch of satyaCsgithub member will merge to the main branch for production deployment
Now the owner will Merge the pull request as shown below,
Then confirm merge with comments added for merging the pull request as shown below,
Now merged with the main branch successfully as shown below,
The interface will be shown with merged status as shown below. We can delete the branch after the pull request is successfully merged and closed.
Now go to the main branch and check the index.html with the latest changes after successfully merged as shown below,
Now check the index.html file with the latest commit message in the main branch for production deployment as shown below,
Now satyaCsgithub members will login and check the pull request or PR request as shown below. Here members will get mail about successfully merged pull requests.
Now check the merged PR status as shown below,
Now check the pull request URL as shown below. It shows merged status.
In this way, we can manage files in GitHub, and at the same time, the user will get the mail for his operation performed. Here the owner will get the updated status about files to change made by other GitHub members in the mail. In this way, the member gets the status in the GitHub account and in the mail simultaneously. After successfully merged in the main branch, the file is ready for production deployment.
The owner will pull the changes in local git from the GitHub repo
Now owner will pull the latest changes in local git as shown below. First, the owner will be identified using Author Identity.
Now the owner will open the solution using Visual Studio and check the index.html under the main branch as shown below,
Now the owner can see the latest changes of index.html under the main branch. Here owner will check the history of commit ID and message as per the latest changes made in GitHub repo by GitHub repo members as shown below,
Summary
In this write-up, we have learned the below details,
- satyaCsgithub member will identify account using author identity
- satyaCsgithub member will clone the GitHub project and create a new branch
- satyaCsgithub member will open and modify the GitHub project
- satyaCsgithub member will add, commit and push the changes to the GitHub repo
- satyaCsgithub member will create a pull request for the latest changes
- The owner will review these changes and ask satyaCsgithub member to fix the issue
- satyaCsgithub member will fix the issue and follow the above steps (1 to 5) in sequence
- The owner again will review these changes
- Finally, the branch of satyaCsgithub member will merge to the main branch for production deployment
- The owner will pull the changes in local git from GitHub repo as made by satyaCsgithub member
Thank You & Stay Tuned For More