Managing Files On GitHub Using Git Bash In Real-Time Scenario - Removing A Specific File From Pull Request

Introduction

In my previous article, we discussed roles of  GitHub reviewer. The reviewer will review the changes in pull request / PR created by the member. The reviewer will add the comments if any changes are required. The member will receive mail about the comments given by reviewer. Also, The reviewer will merge the pull request to main or master branch from member branch. 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,
  1. The reviewer wants some changes in index.html and web.config files
  2. Then new member will modify the files and perform add, commit and push changes
  3. Then new member will create PR of wrong files with main branch
  4. The owner will check and add comments to member to remove this file using git bash
  5. The new member removes this file and push changes. Create PR, add reviewer to owner
  6. Owner will merge the new member code

Note
Before going through this session, please visit my below-mentioned sessions related to Git and GitHub,

  1. Introduction To Git
  2. Steps For Configuring Git With Details
  3. Let's Know About Git Add, Git Commit, Git Status, And Git Push-In Details
  4. Let's Understand How Git Maintains History Of Version Or Commit Ids With Details
  5. Steps To Initialize A Git Repository And Push The Changes To GitHub In Details
  6. Let's Know About Git Branches And How To Implement It
  7. Let's Understand About Git Branches And Its Real-Time Uses
  8. Let's Learn About Merging The Git Branches And Create Pull Request In Details
  9. Steps To Ignore Files Using Gitignore In Details
  10. Let's Learn About Git Default Branch In Detail
  11. Steps To Create And Configure Organizations In GitHub In Details
  12. Let's Learn About GitHub Projects In Detail
  13. Let's Know About Team In GitHub In Details
  14. Managing Files On GitHub In Real-Time - Owner Uploads Project In GitHub Repo
  15. Managing Files On GitHub Using Git Bash In Real-Time Scenario - Know About GitHub Reviewer

The reviewer wants some changes in index.html and web.config files

Here the reviewer will add some comments in PR#1 as described in the previous article to make some changes in Index.html and Web.config files.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then the new member will receive a mail about changes given by reviewer as shown below.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then the new member will login to his/her GitHub account and check the PR#1 for these comments.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then new member will modify the files and perform add, commit and push changes

The member will open the project file and modify the index.html file in calendar section as per requirements.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then the member will run that web application and see the changes as shown below.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

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,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now we can compare the changes of index.html as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now the member makes some changes in Web.config file as shown below. He added the comments in Web.config file.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

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,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now we can compare the changes of index.html as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then new member will modify the files and perform add, commit and push changes

Now, we change the directory to WebApplication1 of the GitHub repo folder as shown below.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

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. We can see those changes in Visual studio as well as in Git Bash.

Using Visual Studio,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Using Git Bash,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Here the member adds the changes of index.html to the staging area as shown below and then commit those changes to the staging area using the command as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Here the member adds the changes of Web.config to the staging area as shown below and then commit those changes to the staging area using the command as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then push those files from local git to GitHub repository using the command as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now, we can see the update in the View History section of index.html after pushing the changes using Visual Studio as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now, we can see the update in the View History section of Web.config after pushing the changes using Visual Studio as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

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,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

After selection of branch, we can see the changes with commit message as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

The commit changes of index.html file as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

The commit changes of Web.config file as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

But in the same index.html and Web.config files if we check the commit messages under the selection of the main branch then these changes are not available as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then new member will create PR of wrong files with main branch

Click the Pull Request option as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then create a pull request with details as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

In pull request, we can check if the before changes and after changes of index.html and Web.config need to be merged under the Files changed option.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

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.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

InfoSatya was requested for review as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Here the owner called InfoSatya will get a mail that @satyaCsgithub requested your review on #2 as shown below. Here #2 is a link navigate to the pull request URL created by satyaCsgithub member i.e. https://github.com/SatyaOrgGlobal/HealthCare-Proj/pull/2

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

The owner will check and add comments to member to remove this file using git bash

Here the owner InfoSatya will login to his GitHub account and review the changes of satyaCsgithub using the pull request URL as described earlier.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Then the Reviewer will check the index.html, Web.config files and its changes under the Files changed section.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Here we check the comments added by the Reviewer to make changes in the index.html file as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Here the satyaCsgithub member will get the mail about the changes requested by the Reviewer as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

The new member remove this file and push changes. Create PR, add reviewer to owner

The member will remove specific file from pull request using Git Bash commands as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

After push these changes the member can see the updated commit messages in history section of Visual studio as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now check the GitHub repo as shown for the latest changes as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now check the Web.config file changes made in GitHub repo as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

So, we check the code status with commit changes as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now we can see the Web.config file has been removed from Files changes section of pull request or PR as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Owner will merge the new member code

Now the owner will Merge the pull request as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now merged with the main branch successfully as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now go to the main branch and check the index.html with the latest changes after successfully merged as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now check the index.html and Web.config files with the latest commit message in the main branch for production deployment as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

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.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now check the merged PR status as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now owner will pull the latest changes in local git as shown below. First, the owner will be identified using Author Identity.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now the owner will open the solution using Visual Studio and check the index.html under the main branch as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Now the owner can see the latest changes of index.html and Web.config 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.

For index.html,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

For Web.config, It does not show anything because from PR this file has been removed. So, the reviewer can't see that commit message after clone the latest changes.

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

But if we open the project directory of member after push changes then we can see the commit message of Web.config file as shown below,

Managing Files On GitHub Using Git Bash 📥📤 In Real-Time Scenario - Removing A Specific File From Pull Request

Summary

In this write-up, we have learned the below details,

  1. The reviewer wants some changes in index.html and web.config files
  2. Then new member will modify the files and perform add, commit and push changes
  3. Then new member will create PR of wrong files with main branch
  4. The owner will check and add comments to member to remove this file using git bash
  5. The new member remove this file and push changes. Create pr, add reviewer to owner
  6. Owner will merge the new member code

Thank You & Stay Tuned For More


Similar Articles