Cant Upload a Lecture to Github Too Big
New to git? Follow the steps below to get comfortable making changes to the code base, opening up a pull request (PR), and merging code into the master branch. Any important git and GitHub terms are in bold with links to the official git reference materials. The first two things y'all'll want to do are install git and create a complimentary GitHub business relationship. Follow the instructions here to install git (if it'due south not already installed). Notation that for this tutorial we will be using git on the control line only. While there are some great git GUIs (graphical user interfaces), I retrieve it'southward easier to larn git using git-specific commands first and and so to try out a git GUI once you're more than comfortable with the command. A note: 95% of other online git resources and discussions will also be for the control-line interface. One time you've done that, create a GitHub business relationship here. A quick aside: git and GitHub are not the same affair. Git is an open up-source, version control tool created in 2005 by developers working on the Linux operating system; GitHub is a company founded in 2008 that makes tools which integrate with git. You do not need GitHub to use git, simply you cannot employ GitHub without using git. There are many other alternatives to GitHub, such as GitLab, BitBucket, and "host-your-own" solutions such as gogs and gittea. All of these are referred to in git-speak as "remotes", and all are completely optional. Y'all do not need to utilize a remote to use git, but it will make sharing your code with others easier. When creating a new project on your local machine using git, y'all'll first create a new repository (or oft, 'repo', for short). To use git nosotros'll be using the terminal. If yous don't have much experience with the terminal and basic commands, bank check out this tutorial (If you don't want/ need a brusk history lesson, skip to step three.) To brainstorm, open upwardly a final and motion to where you want to place the project on your local motorcar using the cd (change directory) command. For instance, if you have a 'projects' folder on your desktop, you'd practice something similar: To initialize a git repository in the root of the folder, run the git init command: Get alee and add together a new file to the project, using any text editor you like or running a affect control. `touch newfile.txt` but creates and saves a blank file named newfile.txt. One time you've added or modified files in a binder containing a git repo, git will observe that the file exists inside the repo. Just, git won't rail the file unless yous explicitly tell it to. Git merely saves/manages changes to files that it tracks, and then nosotros'll need to send a command to confirm that yep, we want git to track our new file. After creating the new file, you lot can use the git status command to encounter which files git knows exist. What this basically says is, "Hey, we noticed you created a new file called mnelson.txt, but unless y'all employ the 'git add' command we aren't going to do annihilation with it." One of the most confusing parts when you're first learning git is the concept of the staging environment and how it relates to a commit. A commit is a record of what changes you have fabricated since the last time you lot made a commit. Essentially, you make changes to your repo (for example, adding a file or modifying one) and then tell git to put those changes into a commit. Commits make up the essence of your project and let y'all to jump to the state of a projection at any other commit. So, how practice you tell git which files to put into a commit? This is where the staging surroundings or index come up in. As seen in Footstep 2, when yous make changes to your repo, git notices that a file has changed simply won't do anything with it (similar adding information technology in a commit). To add a file to a commit, yous first demand to add together it to the staging surroundings. To do this, yous can utilise the git add <filename> control (see Stride 3 below). In one case you've used the git add command to add all the files you desire to the staging environs, you tin can then tell git to package them into a commit using the git commit command. Note: The staging environs, also called 'staging', is the new preferred term for this, but y'all tin can likewise see information technology referred to as the 'index'. Add together a file to the staging environment using the git add command. If you rerun the git status control, you'll see that git has added the file to the staging environment (notice the "Changes to exist committed" line). To reiterate, the file has notyet been added to a commit, but it's near to be. It's time to create your first commit! Run the command The message at the end of the commit should be something related to what the commit contains - maybe it's a new characteristic, maybe information technology'southward a problems fix, perchance it'due south just fixing a typo. Don't put a message like "asdfadsf" or "foobar". That makes the other people who see your commit sad. Very, very, pitiful. Commits live forever in a repository (technically you can delete them if y'all really, really need to but it's messy), so if you leave a clear caption of your changes it can be extremely helpful for future programmers (perhaps futurity you!) who are trying to figure out why some alter was made years after. Now that you've made a new commit, let's endeavor something a little more advanced. Say yous want to make a new feature merely are worried about making changes to the chief project while developing the feature. This is where git branches come in. Branches allow you to move back and forth betwixt 'states' of a project. Official git docs describe branches this manner: 'A branch in Git is simply a lightweight movable pointer to 1 of these commits.' For instance, if y'all want to add together a new page to your website you tin create a new branch just for that folio without affecting the primary part of the projection. Once you lot're done with the page, you can merge your changes from your branch into the primary branch. When you create a new branch, Git keeps track of which commit your branch 'branched' off of, so it knows the history behind all the files. Let's say yous are on the primary branch and desire to create a new branch to develop your spider web folio. Here's what you'll exercise: Run git checkout -b <my branch proper noun>. This command will automatically create a new branch then 'cheque you out' on it, meaning git will move you to that branch, off of the primary co-operative. Subsequently running the to a higher place command, you can use the git co-operative command to confirm that your co-operative was created: The co-operative proper noun with the asterisk next to information technology indicates which co-operative you're on at that given time. Past default, every git repository'southward beginning branch is named `master` (and is typically used every bit the chief branch in the projection). Every bit part of the tech industry'due south general anti-racism piece of work, some groups take begun to use alternate names for the default co-operative (nosotros are using "main" in this tutorial, for example). In other documentation and discussions, you may see "master", or other terms, used to refer to the primary branch. Regardless of the proper name, just keep in mind that nearly every repository has a principal branch that can be idea of equally the official version of the repository. If it's a website, then the primary branch is the version that users run across. If information technology's an awarding, and so the master branch is the version that users download. This isn't technically necessary (git doesn't treat any branches differently from other branches), but it'south how git is traditionally used in a project. If y'all are curious about the conclusion to use dissimilar default branch names, GitHub has an explanation of their alter here: https://github.com/github/renaming At present, if you switch dorsum to the primary branch and brand some more commits, your new branch won't come across any of those changes until y'all merge those changes onto your new branch. If you lot only want to keep track of your code locally, y'all don't need to employ GitHub. But if you lot want to piece of work with a team, you tin can use GitHub to collaboratively alter the project'due south code. To create a new repo on GitHub, log in and go to the GitHub abode page. Y'all tin can find the "New repository" selection nether the "+" sign adjacent to your profile moving-picture show, in the top right corner of the navbar: Afterward clicking the button, GitHub volition inquire y'all to name your repo and provide a brief clarification: When you're washed filling out the information, press the 'Create repository' button to brand your new repo. GitHub will ask if you desire to create a new repo from scratch or if you want to add a repo yous have created locally. In this case, since we've already created a new repo locally, nosotros want to push that onto GitHub then follow the '....or push an existing repository from the command line' department: (Yous'll want to change the URL in the first command line to what GitHub lists in this section since your GitHub username and repo name are different.) Now nosotros'll push the commit in your co-operative to your new GitHub repo. This allows other people to run across the changes you've made. If they're approved by the repository'due south owner, the changes can and so be merged into the primary branch. To push changes onto a new co-operative on GitHub, y'all'll want to run git push origin yourbranchname. GitHub will automatically create the branch for y'all on the remote repository: Yous might be wondering what that "origin" word means in the command above. What happens is that when you clone a remote repository to your local machine, git creates an alias for you. In near all cases this alias is called "origin." Information technology'due south substantially autograph for the remote repository's URL. And so, to push your changes to the remote repository, you could've used either the command: git push button git@github.com:git/git.git yourbranchname or git push origin yourbranchname (If this is your first time using GitHub locally, it might prompt y'all to log in with your GitHub username and countersign.) If yous refresh the GitHub page, you lot'll see annotation saying a co-operative with your name has just been pushed into the repository. You tin can likewise click the 'branches' link to see your co-operative listed in that location. At present click the light-green button in the screenshot above. We're going to make a pull asking! A pull request (or PR) is a way to alert a repo'due south owners that you want to make some changes to their code. It allows them to review the lawmaking and brand sure it looks good earlier putting your changes on the primary branch. This is what the PR page looks like before you've submitted information technology: And this is what it looks like once y'all've submitted the PR asking: Yous might run into a big dark-green button at the bottom that says 'Merge pull request'. Clicking this means you'll merge your changes into the primary co-operative.. Sometimes you'll be a co-owner or the sole owner of a repo, in which case yous may non need to create a PR to merge your changes. Nevertheless, information technology's still a skillful idea to make one so you can go on a more complete history of your updates and to make sure you always create a new co-operative when making changes. Become ahead and click the green 'Merge pull request' push button. This will merge your changes into the primary branch. When you're done, I recommend deleting your co-operative (likewise many branches can become messy), and so striking that grey 'Delete branch' button likewise. Y'all can double bank check that your commits were merged past clicking on the 'Commits' link on the get-go page of your new repo. This volition show y'all a list of all the commits in that branch. You lot tin meet the one I just merged right up top (Merge pull request #1). You can also see the hash code of the commit on the right hand side. A hash code is a unique identifier for that specific commit. Information technology'southward useful for referring to specific commits and when undoing changes (use the git revert <hash code number> command to backtrack). Correct at present, the repo on GitHub looks a little unlike than what you have on your local car. For example, the commit you fabricated in your co-operative and merged into the primary co-operative doesn't exist in the main branch on your local machine. In social club to get the most recent changes that y'all or others have merged on GitHub, apply the git pull origin master command (when working on the primary branch). In most cases, this can be shortened to "git pull". This shows you lot all the files that have changed and how they've changed. At present we can use the git log command again to run into all new commits. (Y'all may need to switch branches back to the chief branch. You can do that using the git checkout master control.) You've successfully made a PR and merged your code to the principal co-operative. Congratulations! If you'd like to dive deeper, check out these more advanced tutorials and resource: I likewise recommend finding some time to work with your squad on simulating a smaller grouping project similar we did hither. Have your team make a new binder with your team proper name, and add some files with text to it. And so, try pushing those changes to this remote repo. That fashion, your squad can start making changes to files they didn't originally create and practice using the PR feature. And, utilise the git arraign and git history tools on GitHub to get familiar with tracking which changes have been made in a file and who made those changes. The more you employ git, the more comfortable you'll... git with it. (I couldn't resist.) *This postal service was originally published in October 2015 by Meghan Nelson, then a senior software engineer at HubSpot. It has since been updated past the HubSpot Product Team. Interested in working for a product squad that values autonomy and transparency? Check out our open up positions and use. Footstep 0: Install git and create a GitHub account
Git and GitHub
Step one: Create a local git repository
Step two: Add a new file to the repo
An interlude: The staging environment, the commit, and you lot
Step 3: Add a file to the staging surround
Step 4: Create a commit
git commit -one thousand "Your message about the commit"
Step v: Create a new branch
A note on branch names
Step 6: Create a new repository on GitHub
Footstep vii: Push a co-operative to GitHub
Step 8: Create a pull asking (PR)
Step 9: Merge a PR
Step 10: Become changes on GitHub back to your computer
Stride xi: Enjoy in your git glory
Github's official git cheat sheets! Handy for remembering the everyday commands you'll utilise.
Confused or intrigued by git's branch system? That simply means you're human! It's 1 of the deepest parts of git, just also arguably the most powerful. Agreement the co-operative model gives you lot git superpowers, and this tutorial gives yous a manner to learn git branches in a visual, intuitive way.
Another tool for exploring git visually. This i is more of an open-ended sandbox than learngitbranching.js.org
A desktop application that helps yous larn git through challenges you have to solve. It has a serial of levels, each requiring you to use git commands to make it at a correct answer.
If yous liked git-it, Githug is another puzzle-based tutorial designed to give you a applied way of learning git.
Source: https://product.hubspot.com/blog/git-and-github-tutorial-for-beginners
0 Response to "Cant Upload a Lecture to Github Too Big"
Post a Comment