Git again

OK so I have been playing about with Git I did the Jason Taylor courses on Udemy and I understood and followed them.  I did though want it in more simple terms as personally I found the stop starting of Udemy, meant I had to go back and reread the last notes I made.  I wanted to reduce it as simple as I could.  So I looked at https://guides.github.com/activities/hello-world/

A 10 minute read I was promised.  So I decided to take up the offer.  All I was going to do was create a repository on Git with a readme file.  Make a branch, amend the readme file on the branch, then merge/push the branch changes to the main branch.

After clicking on create a new repository

repo

The default branch is master.

Now create another branch called feature, this is where the work will be done

After the work is done here it can be merged back into the master.

branch

In the hello-world repository. Click on branch : master and create a new branch called readme-edits.

Select Create branch: readme-edits

Branch created is displayed.

Now there are two branches, master and readme-edits. They look exactly the same, as it is a copy.

Make some edits.

 

Amend the README file, edit and add lines -> Save ->Commit changes

Now open a pull-request

Pull Requests are the heart of collaboration on GitHub. When you open a pull request, you’re proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches. The changes, additions, and subtractions are shown in green and red.

As soon as you make a commit, you can open a pull request and start a discussion, even before the code is finished.

Click on Pull request

Select the branch you made, readme-edits, to compare with master (the original).

Look over your changes in the diffs on the Compare page, make sure they’re what you want to submit.

When you’re satisfied that these are the changes you want to submit, click the big green Create Pull Request button.

Give your pull request a title and write a brief description of your changes.

Click on green create pull request button.

Now merge the pull request. – merging your readme-edits branch into the master branch.

  1. Click the green Merge pull request to merge changes into master.
  2. Click Confirm merge.
  3. Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.

So to recap this procedure the following happened.

  • Created an open source repository
  • Started and managed a new branch
  • Changed a file and committed those changes to GitHub
  • Opened and merged a Pull Request

This was very straight forward and I’m so happier with doing git this way.

Leave a Reply

Your email address will not be published. Required fields are marked *