m Github Hello World Tutorial
Key Points
References
Reference_description_with_linked_URLs_______________________ | Notes______________________________________________________________ |
---|---|
m Github scm | |
https://git-scm.com/docs | Git 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/desktop | GitHub 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
No coding necessaryTo 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).
|
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 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.
- Click the green Merge pull request button to merge the changes into
master
. - Click Confirm merge.
- 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 ..
- created a repo
- created a branch from master
- edited a file
- committed the changes
- opened a pull request for team review of the change
- reviewed input from the team
- successfully merged the change from the pull request back to the master branch
What else is there to cover ? Lots
- You probably want to do the edits to the repo locally and test your changes locally before opening a pull request
- You probably want to add team mates to your repo to review the changes
- You probably want to setup the repo as part of an organization domain shared by the team
- You MAY decide you need private ( not public ) repos for your teams work
- 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
- find the closed pull requests
click the pull request that's associated with the branch that you want to delete.
Near the bottom of the pull request, click Delete branch.
Revert 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
- Add remote repositories by URL under ADD
- Create local repositories
- 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
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 codeGit 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
- Delete the local repository
- From Github web, login and find the repo and branch to clone
- Select Clone
- Select Github Desktop to open
- Select the folder to download to
- << the clone runs fine
- << 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
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
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
- In Github repo history tab
- select the commit to revert
- RB menu > Revert this commit