m Github Hello World Tutorial

Key Points


References

Reference_description_with_linked_URLs_______________________Notes______________________________________________________________
m Github scm


https://git-scm.com/docsGit documentation
https://guides.github.com/activities/hello-world/Github basics - example
https://help.github.com/en/github/authenticating-to
-github/connecting-to-github-with-ssh
Github connection setup with SSH


https://desktop.github.com/download Github desktop
https://docs.github.com/en/free-pro-team@latest/desktopGitHub desktop docs online
github-4-dummies-v2-2023    link


Learn Github basics - Hello World Tutorial

https://guides.github.com/activities/hello-world/

github-guides.github.com-Hello World.pdf

Managing project source with Github


GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.

This tutorial teaches you GitHub essentials like repositories, branches, commits, and Pull Requests. You’ll create your own Hello World repository and learn GitHub’s Pull Request workflow, a popular way to create and review code.

What the Tutorial covers

  1. What is GitHub?
  2. Create a Repository
  3. Create a Branch
  4. Make a Commit
  5. Open a Pull Request
  6. Merge Pull Request

No coding necessary

To complete this tutorial, you need a GitHub.com account and Internet access. You don’t need to know how to code, use the command line, or install Git (the version control software GitHub is built on).

Tip: Open this guide in a separate browser window (or tab) so you can see it while you complete the steps in the tutorial.


create the repo 


after creating the repo 


Create a branch - doc-update1


new branch is created 


Make changes to the README.md file and commit in doc-update1 branch


after editing the file, commit the change to the same branch and see the results.

the result is 


Create a pull request to review the change with team mates

https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests

pull requests make it easy to review changes with team mates prior to a merge to master branch

Nice edits! Now that you have changes in a branch off of master, you can 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.

You can even open pull requests in your own repository and merge them yourself. It’s a great way to learn the GitHub flow before working on larger projects.


Click pull requests tab to open new pull request


In pull request window, compare current branch to master to see impacts

IF the changes look good click "create pull request" to open the pull request



Click Create Pull Request and add comments and notifications to team mates as needed


Under the pull requests tab you can see the pull request made 


Merge Pull Request to Master after reviews are approved

In this final step, it’s time to bring your changes together – merging your readme-edits branch into the master branch.

  1. Click the green Merge pull request button to merge the 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.


Take the option to add comments if needed.

Then "Merge Pull Request" 


after confirming the merge, the Pull Request shows that it has been merged to Master branch



Github Tutorial completed for Hello World

you ..

  1. created a repo 
  2. created a branch from master
  3. edited a file
  4. committed the changes
  5. opened a pull request for team review of the change
  6. reviewed input from the team
  7. successfully merged the change from the pull request back to the master branch


What else is there to cover ? Lots 

  1. You probably want to do the edits to the repo locally and test your changes locally before opening a pull request
  2. You probably want to add team mates to your repo to review the changes
  3. You probably want to setup the repo as part of an organization domain shared by the team
  4. You MAY decide you need private ( not public ) repos for your teams work
  5. You MAY decide you need to use secure connections to move changes between your Github repo and your local repo copy


Manage Pull Requests 


Close Pull Request 

https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/closing-a-pull-request

You may choose to close a pull request without merging it into the upstream branch. This can be handy if the changes proposed in the branch are no longer needed, or if another solution has been proposed in another branch.

Under the github repo, select pull requests tab

select the pull request, below the comment box, click Close pull request.

Optionally, delete the branch

https://docs.github.com/en/github/administering-a-repository/deleting-and-restoring-branches-in-a-pull-request

  1. find the closed pull requests
  2. click the pull request that's associated with the branch that you want to delete.

  3. Near the bottom of the pull request, click Delete branch.


Revert Pull Request 

https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/reverting-a-pull-request

Reverting a pull request on GitHub creates a new pull request that contains one revert of the merge commit from the original merged pull request.

Note: You may need to revert the individual commits in your pull request if either of the following is true.

  • Reverting the pull request causes merge conflicts
  • The original pull request was not originally merged on GitHub. For example, someone could have merged the pull request using a fast-forward merge on the command line.

For more information about using Git to manually revert individual commits, see Git revert in the Git documentation.





Create and Clone Repos


  1. Add remote repositories by URL under ADD
  2. Create local repositories
  3. Clone remote repositories to Local GitHub folder


https://docs.github.com/en/free-pro-team@latest/desktop

Quick setup — if you’ve done this kind of thing before

or


Git create new repo and push

Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line

echo "# ebc-chaincode" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Paramount-Software-Solutions/ebc-chaincode.git
git push -u origin main
                

…or push an existing repository from the command line

git remote add origin https://github.com/Paramount-Software-Solutions/ebc-chaincode.git
git branch -M main
git push -u origin main

…or import code from another repository

You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

Import code


Git pull repo to local folder ( vs clone )


Git pull combines a local fetch and merge

Git pull can have issues IF any local files have NOT yet been published to the repo you are pulling from


Simple Git pull from a Github repo using Clone


  1. Delete the local repository
  2. From Github web, login and find the repo and branch to clone
  3. Select Clone 
  4. Select Github Desktop to open
  5. Select the folder to download to
  6. << the clone runs fine
  7. << future pulls from Github Desktop should run fine without complaint unless local files changed


Compare Commits across branches, the same branch

https://docs.github.com/en/github/committing-changes-to-your-project/comparing-commits



compare commits across branches

https://docs.github.com/en/github/committing-changes-to-your-project/comparing-commits



compare commits across forks

https://docs.github.com/en/github/committing-changes-to-your-project/comparing-commits



compare commits on the same branch

https://docs.github.com/en/github/committing-changes-to-your-project/comparing-commits

https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-comparing-branches-in-pull-requests#three-dot-and-two-dot-git-diff-comparisons

You can also compare two arbitrary commits in your repository or its forks on GitHub in a two-dot diff comparison.

To quickly compare two commits or Git Object IDs (OIDs) directly with each other in a two-dot diff comparison on GitHub, edit the URL of your repository's "Comparing changes" page.

For example, this URL uses the shortened seven-character SHA codes to compare commits c3a414e and faf7c6f: https://github.com/github/linguist/compare/c3a414e..faf7c6f.

To learn more about other comparison options, see "Three-dot and two-dot diff comparisons."


Revert to a different commit level in a Repo

https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/reverting-a-commit

Tip: When you revert multiple commits, it's best to revert in order from newest to oldest. If you revert commits in a different order, you may see merge conflicts.


Steps

  1. In Github repo history tab
  2. select the commit to revert
  3. RB menu > Revert this commit


Git Documentation 

https://git-scm.com/docs