# data[].attributes.attachment_link.readable_text
In our previous tutorials for the git version control software, we learned the essential basic commands for using git, as well as how to work with Github.com to establish a repository and push our project code to the website.

Now it is time to start actually working with GitHub (and git) the way they are meant to be used: making changes in the project safely off to one side, and merging them back into the original project once they have proved to be correct. Or at least not disastrous.

Yes, Master

By now you understand that git saves each version of your project as a snapshot of the code exactly as it was at the moment you committed it. Essentially creating a timeline of versions of a project as it progresses, so that you can roll back to an earlier version in the event disaster strikes.

The way git, and GitHub, manage this timeline - especially when more than one person is working in the project and making changes - is by using branches. A branch is essentially is a unique set of code changes with a unique name. Each repository can have one or more branches. The main branch - the one where all changes eventually get merged back into, and is called master. This is the official working version of your project, and the one you see when you visit the project repository at github.com/yourname/projectname.

Do not mess with the master. If you make changes to the master branch of a group project while other people are also working on it, your on-the-fly changes will ripple out to affect everyone else and very quickly there will be merge conflicts, weeping, rending of garments, and plagues of locusts. It's that serious.

Why is the master so important to not mess with? One word: the master branch is deployable. It is your production code, ready to roll out into the world. The master branch is meant to be stable, and it is the social contract of open source software to never, ever push anything to master that is not tested, or that breaks the build. The entire reason GitHub works is that it is always safe to work from the master.

Branching Out

Instead, everyone uses branches created from master to experiment, make edits and additions and changes, before eventually rolling that branch back into the master once they have been approved and are known to work. Master then is updated to contain all the new stuff.

To begin working on anything new in a project, or to change existing things, you create a branch off the stable master branch. Let's continue working with the sample project created for our previous tutorial, good ol' studious_octo_carnival. Please now open up your version on your computer and cd into the directory.

Step 1: Take inventory.

Prior to creating new branches, we want to check for any other existing branches. We know about the master, but who knows what our project collaborators may be up to, those mischievous monkeys? So we can view all existing branches by typing "git branch -a" into terminal, which tells git that we want to see ALL the branches in this project, even ones that are not in our local workspace.

This returns output you see in the code example below. Its appearance may vary somewhat depending on your OS and terminal application, but the info is ultimately the same. The asterisk next to "master" in the first line of the output indicates that we are currently on that branch. The second line tells us that on our remote, named origin, there is a single branch, also called master. (Remember that our remote is the GitHub repo for this project).

Step 2: Create a new branch

Now that we know how to view branches, let's make one! Bear in mind as we go that we have our master branch, our original project. We are now going to create a new version of the project, a branch, to play around with and make changes in locally on our computer - while the original version of the project, the master, remains safely unmolested up there on GitHub. We give the new branch a descriptive name to remind us what we intend to do while working in it. In this case, it's going to be a simple "Hello World" thingy, so let's call it hello_octo.

To create this new branch, type "git checkout -b branchNameHere" (so, in our case, "git checkout -b hello_octo").

Assuming nobody else has already made a branch named "hello_octo", git returns "Switched to a new branch 'hello_octo'." (In the case where a branch by that name already exists, git would tell us instead "fatal: A branch named 'hello_octo' already exists." No big deal, just do git checkout -b again with a new name variation).

We can also use the git checkout command to toggle back and forth between our two branches. Type "git checkout branchName" to switch to that branch. So, "git checkout master" takes you to master while "git checkout hello_octo" takes you back to hello_octo branch.

If you try to switch to a branch that doesn't exist, such as "git checkout hello_kitty", git will let you know that's a no-go:

How does git know what branch you're currently on? Git is always watching what you do and keeps a special pointer called HEAD. Like the needle on a compass always points north, HEAD always indicates the local branch you're currently on.

(We could also have created our branch using the git command "git branch branchNameHere", and then switch to it with git checkout. However, the neat little shortcut with the "-b" in "git checkout -b branchNameHere" both creates the branch AND switches to it. I cannot tell you how many new-to-git coders generate error messages and frustration because they simply have not remembered to change to their new branch after creating it. Hence, we are sticking with git checkout -b, mmmkay?)

Making changes to our working branch

Now that we have multiple branches - our working branch to make changes on, and our master branch remaining safely unmolested - we can get to work. In our scenario, we are going to use our "hello_octo" branch for making and testing our changes, and then push these back up to the master branch on GitHub.

Remember to make sure you're on your working branch, and not master, with good old git branch -a.

Step 3. Create a new blank file, named "hello_octo_world":

(This blank file is just for demonstration purposes, so no worries that there is no file extension name/type).

Since it is brand new, right now this file is only on your branch. Use the "ls" command to view it:

However, recall that we are on our working branch, hello_octo, where we created this new thing. The master doesn't know anything about no hello_octo, because it is safely insulated from any willy-nilly changes we are making over here on the working branch. It is still the same serenely unchanged master we started with:

Step 4: Stage and commit our new file to working branch.

Now it is time to stage (add) and commit our new file on the working branch. (Sound familiar?). This will attach this new entity to the working branch in preparation for eventually moving it over to master. This file now exists on the hello_octo branch; as we saw above, it doesn't currently exist on the master branch.

At this point you have just taken a snapshot of changes to the branch. In a real-world project, there are likely more changes and work to be done. Now is when you would go do this, making commits along the way at logical points. Remember that, on GitHub, commits represent your consecutive saves. Each commit has an associated commit message, which is a description explaining specifically what you did there and why. Commit messages capture the history of your changes, so future you, as well as other project contributors, can understand what you've done and why.

Merging Code Between Branches

Once we are finally done with all changes and additions - and everything works* - it's time to merge. The interesting part comes after we switch back to our master branch (which - say it with me! - we do with "git checkout master"). "Hello_octo_world" appears to be missing, but it's not - currently, it exists on our working branch and we are on our master branch. I'm showing you this again because it is at the heart of understanding branches in git:

Now: in this exercise, "hello_octo_world" represents any change to any file (or the addition of a whole new file) that has passed all testing on our development branch, and is ready to be in production. The process of moving code between branches (often from development to production) is known as merging.

Very important: when merging, we need to be on the branch that we want to merge to. Basically, we will be telling git, "See that new thing? It's ok to bring it over here now."

Step 5: Merge working branch changes to the master.

In this case, since we want to merge from our working branch, where the "hello_octo_world" file exists, to our master branch, we need to be on the master.

Once on the master branch, all we have to do is run the merge command. The best way to do this is to type "git merge -no-ff" - the additional "-no-ff" tells git we want to retain all of the commit messages prior to the merge. This will make tracking changes easier in the future:

Getting Back to GitHub

The last thing we now need to do is to let GitHub know that we've been monkeying around with master down here on our local development environment.

In other words, it's time for git push. You got this!

The git output confirms that the merge from your develop branch to the master branch on your local environment, has now been copied to the remote server: "master → master."

And that's it! We successfully created a working branch separate from master. Made changes to it. Staged and committed those changes. Then merged them back into master on our local working environment. Then, finally, pushed everything up to GitHub so that all versions of our project are the same, everywhere!

A Final Note

Some cleanup is in order now: since we have successfully merged our hello_octo branch, we no longer need it. To delete a merged branch, simply type "git branch -d branchName":

No worries: if you accidentally attempt to delete a branch that has not yet been merged, git will throw an error.

So! This far we have been using an extremely simplified sample project, because at this point the most important thing is to understand and assimilate the git workflow. There is a lot more to merging than this in the real world - for example, what happens if you get error messages because your merge has conflicts? No worries, new git-ster, we will get there.

Your homework: create ("touch") some more new files in the example project and practice making changes, staging, committing, and finally merging them back. Take care to understand where your HEAD is pointing - i.e., what your current branch is. Only commit changes to your working branch.

Because, remember: Don't. Mess. With. The. Master.

# data[].attributes.attachment_link.title
Don't Mess with the Master: Working with Branches in Git and GitHub - The New Stack

# data[].attributes.attachment_link.description
In our previous tutorials for the git version control software, we learned the essential basic commands for using git, as well as how to work with Github.com to establish a repository and push our project code to the website. Now it is time to start actually working with GitHub (and git) the way they are meant ...

# data[].attributes.attachment_link.readable_text
Just to let you know, if you buy something featured here, Mashable might earn an affiliate commission.

Have you ever taken a good look at your browser and wondered why it looks the way it does? Listen, you don't even have to dive into the deep, dark pits of the Internet to find out why. The answer is plain and simple: JavaScript.

You cannot be taken seriously as a developer if you are not well-versed in Javascript. It's the most popular programming language used on the web today. The sites you frequently visit, the games you play on the reg, the apps you rely on, they would not exist if it weren't for JavaScript.

So if you're thinking of picking up your first programming language, it's a bit of a no-brainer - JavaScript is the one to learn. Need a bit more convincing? Here are compelling reasons why it's THE language of all languages:

1. It's free!

If you wish to start your journey to mastering JavaScript ASAP, well, good news for you: you can begin right about now. Like, right this second, and that's not even an exaggeration. There are no unnecessary installations required with JavaScript. All you need is a trusty program code editor and your internet browser to get started.

2. It's pretty much everywhere.

JavaScript is the digital equivalent of the English language in the sense that it's universally recognized. It's also weaved into the fabric of programming. You see it everywhere; you're just not aware of it. JavaScript is present in every platform imaginable - browsers, mobile and desktop applications, IoT devices, and more!

3. It's noob-friendly.

Even those who have never dipped their toes in programming can be a JavaScript ninja. Its syntax is so straightforward and easily digestible that it can be picked up by beginners in no time.

4. It serves as a great foundational language.

If you wish to delve into more complex programming languages, then JavaScript is the perfect springboard. Once you understand it on a deeper level, learning other languages will be a piece of cake.

5. It's fun and interactive.

Since JavaScript is heavily utilized in front-end development, you can tinker with graphical interfaces however you want. You can play with animation, design beautiful UIs, build games, and so on. The possibilities are endless.

6. It's powerful.

What do Paypal, Netflix, LinkedIn, and Uber all have in common? They all run on JavaScript - Node.js to be specific. The majority of the world's top websites and apps use JavaScript in one way or another.

7. It's relatively easy to debug.

Unlike other languages, JavaScript has a quick feedback loop. Since it's built on the browser, you can run your code and get results instantaneously. That way, you can learn and improve so much faster.

8. There's a high demand for JavaScript pros.

Since more and more businesses are going digital, there is a high demand for people skilled in JavaScript. And as the programming language continues to grow, the interest in JavaScript developers should also continue to skyrocket.

9. It can lead you to a lucrative career.

The average salary for JavaScript programmers ranges from $74,000 to $130,000. 'Nuff said.

10. It's rapidly evolving.

JavaScript's ecosystem continues to evolve by the second. There are constant developments, meaning there is also an endless opportunity for growth.

Stop wasting your time trying to learn other programming languages and dive into the world of JavaScript today. Pick up the Ultimate JavaScript eBook and Course Bundle to get started. It gives you access to 16 best-selling books and 30 hours of training. Right now, it's only $29 at the Mashable Shop - a savings of 94%.

# data[].attributes.attachment_link.title
10 reasons why JavaScript is the programming language you should learn now

# data[].attributes.attachment_link.description
Just to let you know, if you buy something featured here, Mashable might earn an affiliate commission. Have you ever taken a good look at your browser and wondered why it looks the way it does? Listen, you don't even have to dive into the deep, dark pits of the Internet to find out why.

# data[].attributes.body
These tutorial sites are good because one can learn and try without leaving the site.

# data[].attributes.attachment_link.readable_text
JavaScript is the world's most popular programming language.

JavaScript is the programming language of the Web.

JavaScript is easy to learn.

This tutorial will teach you JavaScript from basic to advanced.

Start learning JavaScript now "

Examples in Each Chapter

With our "Try it Yourself" editor, you can edit the source code and view the result.

Use the Menu

We recommend reading this tutorial, in the sequence listed in the menu.

If you have a large screen, the menu will always be present on the left.

If you have a small screen, open the menu by clicking the top menu sign ☰.

Learn by Examples

Examples are better than 1000 words. Examples are often easier to understand than text explanations.

This tutorial supplements all explanations with clarifying "Try it Yourself" examples.

If you try all the examples, you will learn a lot about JavaScript, in a very short time!

JavaScript Examples "

Why Study JavaScript?

JavaScript is one of the 3 languages all web developers must learn:

1. HTML to define the content of web pages

2. CSS to specify the layout of web pages

3. JavaScript to program the behavior of web pages

This tutorial covers every version of JavaScript:

The Original JavaScript ES1 ES2 ES3 (1997-1999)

The First Main Revision ES5 (2009)

The Second Revision ES6 (2015)

All Yearly Additions (2016, 2017, 2018, 2019, 2020)

Learning Speed

In this tutorial, the learning speed is your choice.

Everything is up to you.

If you are struggling, take a break, or re-read the material.

Always make sure you understand all the "Try-it-Yourself" examples.

The only way to become a clever programmer is to: Practice. Practice. Practice. Code. Code. Code !

Commonly Asked Questions

How do I get JavaScript?

Where can I download JavaScript?

Is JavaScript Free?

You don't have to get or download JavaScript.

JavaScript is already running in your browser on your computer, on your tablet, and on your smart-phone.

JavaScript is free to use for everyone.

My Learning

Track your progress with the free "My Learning" program here at W3Schools.

Log in to your account, and start earning points!

This is an optional feature. You can study W3Schools without using My Learning.

JavaScript References

W3Schools maintains a complete JavaScript reference, including all HTML and browser objects.

The reference contains examples for all properties, methods and events, and is continuously updated according to the latest web standards.

Complete JavaScript Reference "

JavaScript Quiz Test

Test your JavaScript skills at W3Schools!
Start JavaScript Quiz!
Kickstart your career

Get certified by completing the course

# data[].attributes.attachment_link.description
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

# data[].attributes.body
This website is important for those who want to learn Git

# data[].attributes.attachment_link.description
Git is a powerful, sophisticated system for distributed version control. Gaining an understanding of its features opens to developers a new and liberating approach to source code management. The surest path to mastering Git is to immerse oneself in its utilities and operations, to experience it first-hand.

# data[].attributes.body
Great to understand Git concepts.

# data[].attributes.attachment_link.description
The entire Pro Git book, written by Scott Chacon and Ben Straub and published by Apress, is available here. All content is licensed under the Creative Commons Attribution Non Commercial Share Alike 3.0 license. Print versions of the book are available on Amazon.com.>

# data[].attributes.body
Group Members:
Jay Thakkar (ID: 19040586)
Saurabh Ningawale (ID: 19041520)

# data[].attributes.attachment_link.readable_text
MongoDB is an open-source document database and leading NoSQL database. MongoDB is written in C++. This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly scalable and performance-oriented database.

This tutorial is designed for Software Professionals who are willing to learn MongoDB Database in simple and easy steps. It will throw light on MongoDB concepts and after completing this tutorial you will be at an intermediate level of expertise, from where you can take yourself at higher level of expertise.

Before proceeding with this tutorial, you should have a basic understanding of database, text editor and execution of programs, etc. Because we are going to develop high performance database, so it will be good if you have an understanding on the basic concepts of Database (RDBMS).

Get Started

# data[].attributes.attachment_link.description
MongoDB Tutorial - MongoDB is an open-source document database and leading NoSQL database. MongoDB is written in C++. This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly scalable and performance-oriented database.

# data[].attributes.attachment_link.description
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

# data[].attributes.attachment_link.readable_text
Developers, teams, and businesses of all sizes use Heroku to deploy, manage, and scale apps.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly. Learn more about Heroku solutions and how the platform can benefit your app development.

Work with the language you already love

A powerful and innovative feature set

Built for developers, by developers.

Continuous delivery

Heroku Flow uses Heroku Pipelines, Review Apps and GitHub Integration to make building, iterating, staging, and shipping apps easy, visual, and efficient.

Smart containers

Your apps run in smart containers called dynos, where the system and language stacks are continually monitored, patched, and upgraded by our team.

Heroku Enterprise

The Heroku experience developers love,
with the enterprise features large companies need.

San Diego, CA
About the Conference RubyConf is the annual fall conference for Ruby enthusiasts to gather and enjoy talks about new projects, meet and network with other Ruby developers, and h...

The Cloud Native Computing Foundation's flagship conference gathers adopters and technologists from leading open source and cloud native communities in Chicago, Illinois from November 6-9, 2023....

La última y nos vamos
One more for the road. JSConf Colombia is not just a conference; it's a celebration. One that is a testament to the power of unity, knowledge, ...

*Redis is a trademark of Redis Labs Ltd. Any rights therein are reserved to Redis Labs Ltd. Any use by Salesforce is for referential purposes only and does not indicate any sponsorship, endorsement or affiliation between Redis and Salesforce.

# data[].attributes.attachment_link.description
Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.

# data[].attributes.attachment_link.description
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

# data[].attributes.body
Explains a lot of git concepts in a very short time.

# data[].attributes.attachment_link.title
An Introduction to Git and GitHub by Brian Yu