Uploading to Your Github Repository From Command Line
Using GitHub without the command line
By Craig Lockwoodx May 2017 Tutorials
If the sight of a concluding or command line frightens you, this guide by Craig Lockwood will teach you to use GitHub to collaborate with others without ever touching the command line
This guide will teach y'all how to:
- Create an account on GitHub.com
- Create a repository
- Manage and create branches
- Commit changes to a repository
- Open and merge pull requests
- Create mentions and discussion
Introduction
GitHub is at present the largest online collection of collaborative works that exists in the world. Developers, engineers and designers all over the world are using GitHub to interact and share code with others.
Once GitHub has become a role of your working routine, y'all will wonder how yous managed without it. However, there is quite a steep learning curve to using GitHub. At that place are hundreds of tutorials on the spider web to help beginners get to grips with GitHub, only most require extensive knowledge of using the command line. There is, however, a style of using the most commonly used features without ever having to open a control line.
What is GitHub?
Before we acquire most GitHub, it is important to understand what Git is.
Initially developed in 2005, Git has now been become the most popular choice amongst developers and engineers to manage lawmaking. Git is what'due south known every bit a distributed version command system. That means when you clone a repository you have a consummate copy of the entire repository including its history. Think of a repository as a database where records of all changes to your files are kept. A distributed system similar Git ways that anyone who has a copy of a repository on a local computer essentially has a complete backup. Git has gained popularity over contempo years for this and a number of other reasons.
A local repository tracking our commits is fine, but it's not a fail-prophylactic and doesn't lend itself to collaboration. This where services like GitHub come up in.
Tip: GitHub is not unique. There are many alternatives, such as Bitbucket, Beanstalk and Codebase. GitHub, however, is a very popular service and offers a gratuitous account, which makes it an ideal choice for u.s. to apply in this guide.
Step 1: Create a GitHub account
Creating an account on GitHub is straightforward, best of all, GitHub is complimentary to use for public and open up source projects. If you would like to keep your projects (repositories) individual and not publicly available there are paid plans - in this example, a free account volition serve our purposes just fine.
Visit GitHub.com and selection a username. Once yous have submitted an email accost and called a password your account will exist agile - you lot are ready to go.
Step two: Create a new repository
A repository (sometimes called a repo) is a container used to organise a project. Repositories comprise all of the folders and files needed for your projection. This can include text files, images, videos, or whatsoever other kind of file you could recall of.
For the purpose of this walkthrough, we will create a repository calledExam-REPO.
- Click the+ sign next to your avatar in the meridian right corner and selectNew repository.
- Name your repository
TEST-REPO. - Write a short clarification of your project.
- SelectPublic.
- SelectInitialize this repository with a README.
- ClickCreate repository.
A repository calledTEST-REPO will then exist created and yous will be taken to the repository folio. Notation that the URL construction for the repository will existgithub.com/business relationship-proper noun/repository-name.
Here you will run into a list of all the files associated with this repository forth with a commit message (more of this subsequently) and a engagement/time of when that file was final changed. In our case, nosotros will only see the auto-generatedREADME.md file.
Step 3: Create a new co-operative
Branching involves diverging from your main line of development and continuing to work without affecting that main line. When you initialize a new Git repository, by default you're checked into themaster branch. Branching tin exist a great way of working on a feature of a projection without affecting themaster code. When yous have finished working on your new characteristic you lot can then merge your new code into the main codebase, themain branch.
The diagram above shows a branch from themaster branch calleddevelopment. After multiple changes, thedevelopment branch is and then merged back into themainbranch.
Let's create a new branch chosendevelopment.
- Select the drop down at the superlative of the file listing that says
branch: <potent>master</strong>. - Create a new branch name, is this case, call it
development. - Select the blueCreate branchbox.
At this indicate, you should have two branches, master and evolution. Both branches will be identical as we have yet to makes whatever changes. You lot can check in and out of the two branches past selecting from theco-operative drop downwardly list.
Step 4: Make changes and commit them to a repository
Before we go whatsoever further, make sure you accept selected thedevelopment branch equally we are about to brand some changes. When a change is made, these changes are saved ascommits. Each fourth dimension you commit it is a good thought to add a brusque commit message, this creates a readable history of the projection and allows others who may be contributing to the project to understand what is going on at a glance.
Let's start by making some changes to the README.md file.
- Select the
README.mefile. - Select the pencil icon in the height right of the corner of the file viewer.
- In the edit window, type a few lines of text - anything will do (you can style the text if you wish using the Markdown syntax)
- Create a commit message where it saysAdd an optional extended clarification....
- Select theCommit changes button.
The changes just made to theREADME.dr. file on thedevelopment co-operative volition only be visible on thedevelopment co-operative, themaster branch will even so show the former, unchanged version of theREADME.me file.
Step 5: Pull requests and merging
So now we have two branches, each slightly unlike as thedevelopment branch has had a modify which we have and then committed. To keep themaster branch upwards to date, we will now await topull whatsoever updates into themaster branch - this is done using aPull Request.
Pull Requests are what makes GitHub such a great tool for collaboration. At this point we have fabricated changes to a file ourselves, merely in theory, anybody could brand these changes and then ask for a Pull Request, allowing their edits to be merged into a project. A Pull Request needs to be reviewed before the changes are merged, this prevents bad piece of work from entering a branch.
A Pull Request will highlight the differences (oft calledDiffs) in the content betwixt branches. Changes can be additions or subtraction to the content. Additions are highlighted in green whilst subtractions are highlighted in red.
So permit'southward open a Pull Request for the changes that we made to theREADEME.md file.
- Select thePull Requests tab - only nether the repository title.
- Select the greenNew pull request push button.
- Select the best branch
masterto compare with the branch which includes the changes fabricated, in this casedevelopment.
- If you are happy that you lot wish to submit these changes, select the light-greenCreate Pull Request push button.
- Merely every bit you lot did when y'all created a commit bulletin earlier, write a clarification of your changes.
- Select theCreate pull request.
The Pull Request is now open. This means that the changes are ready to exist merged into themain branch.
The final step to merging the differences betwixt branches is to merge the Pull Request. To practise this, select the greenMerge pull request.
Step half dozen: Create mentions and discussion
We mentioned earlier that every bit well as an splendid platform for keeping track of versions of your work, GitHub is also great at collaboration. Thankfully, Github has a great mechanism for discussion in the form ofmentions.
When you make a Pull Request, yous may want to brand a note to a item collaborator. By using the@ symbol followed by a GitHub username, you can ship a message to a collaborator, colleague, or anybody within the GitHub community. This characteristic is bang-up for flagging issues, errors or areas for further discussion.
Congratulations, you lot now know the basics of using GitHub
Yous have now learnt to use GitHub for collaboration with others. At that place are plenty of further resource should you wish to larn more about using GitHub. Some of our favourites are listed below:
- Git for humans
- GitHub flow guide
- GitHub for beginners
Source: https://pixelpioneers.co/blog/2017/using-github-without-the-command-line
0 Response to "Uploading to Your Github Repository From Command Line"
Postar um comentário