Can You Use Git Without GitHub?

Can you use Git without GitHub?

The short answer is yes, you can. Git is a tool for revision control. GitHub is an online service that allows you to store, manage, and share Git repositories in the cloud. You can use Git with online services other than GitHub, with an in-house server, or on your local computer without any server at all.

First, let’s look at what Git is. Then, let’s see what GitHub and other Git-hosting services have to offer.

What Is Git?

Git is a revision control tool. It’s most often associated with software development, but you can use it to track changes in any file. For example, Git has gained a lot of traction as a tool for managing system configuration and software deployment via infrastructure-as-code best practices.Whether you decide to share your code with a team via a server or use it to manage your code locally, your Git repository looks the same. So, that’s why you can use Git without GitHub: Git works as a standalone tool or with a server.

Because of its distributed nature, Git is different from most other version-control systems. All computers that share a set of files (a repository, in Git terminology) have a complete set of files and changes. So, whether you decide to share your code with a team via a server or use it to manage your code locally, your repository looks the same.

So, that’s why you can use Git without GitHub: Git works as a standalone tool or with a server.

Let’s talk about Git’s version-control features.

What Is Revision Control?

The purpose of revision control is to track changes to files, make it easy to see those changes, and provide an easy way for you to shift from one revision to another.

Let’s look at a typical workflow using Git terminology. These examples will use Git on a Unix system, but the concepts apply to any system that supports Git.

Create a Git Repository

To track a file, you need to put it in a repository:

$ mkdir git_test
$ cd git_test
$ git init
Initialized empty Git repository in /Users/egoebelbecker/git_test/.git/

The git init command creates a repository in the current directory.

$ touch test.txt
$ git add test.txt
$ git commit -m "Initial commit" .
[master (root-commit) 7e33531] Initial commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test.txt

Touch created an empty file.

Git add test.txt added the file to the repository.

But the change wasn’t applied to the repository until git commit. This is an important concept; Git doesn’t track changes until you commit them. This initial commit has a revision ID of 7e33531.

Commit a Change to Git

Now, change the file.

$ echo foo > test.txt
$ cat test.txt
foo
$ git commit -m "Added foo" test.txt
[master a6beff0] Added foo
 1 file changed, 1 insertion(+)

After adding some text to the file, commit added the change to the repository. The new revision ID is a6beff0.

Compare Files With Git

Now, you can compare the two commits with their IDs:

$ git diff 7e33531 a6beff0
diff --git a/test.txt b/test.txt
index e69de29..257cc56 100644
--- a/test.txt
+++ b/test.txt
@@ -0,0 +1 @@
+foo

The output shows the file being added and then modified. Don’t worry; you don’t have to learn to read the diff—many tools can read it for you (but you can learn it if you want, too).

Finally, move to a previous revision with checkout:

$ git checkout 7e33531
Note: switching to '7e33531'.

You are in 'detached HEAD' state. You can look around, make experimental
changes, and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c 

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 7e33531 Initial commit
$ cat test.txt
$ 

Passing the previous revision ID to git checkout changes the current working directory to that state.

Git’s default behavior, when you move back like this, is to warn you that you are in a “detached head” state. It also gives you instructions on how to turn the warning off. The warning means that you and your repository are no longer in sync. This isn’t a problem if you’re aware of it.

The HEAD that Git warns you about is a pointer to the last commit in your current branch. The warning also hints that you might want to work in a new branch instead of a detached head.

A branch is a set of changes. When you create a repository, it has one branch, the master or “trunk.” You can start a new branch at any point in an existing one. Branches can be merged.

Branching allows you to work on multiple versions of your code at a time without conflicts. For example, one branch can be for bug fixes to the release in current production, while another is for working on new features. You (or your team) can work in separate branches without causing conflicts. Later, the branches can be merged, and if there are any conflicts, you can sort them out then.

How and why to use branches is a deep and sometimes controversial topic.

This overview of Git is only the tip of the iceberg. Git has many other features for managing source code, such as tagging and pull requests.

Distributed Version Control

A Git server provides remote storage for a Git repository. You push and pull changes to your repo. For an individual developer, a Git server acts as a backup, and an online service like GitHub is an off-site backup.

For a team, a Git server is a coordination point for code changes. One developer may work on bugs on a “production” branch and push their changes when it’s time to release a fix. Another might work on new features on a “development” branch.

GitHub repository
A GitHub repository. Image credit: Pixabay.com

When a set of features is ready for release, the developer working on the features creates a pull request that lists the changes required to merge to production. The team reviews the changes, and they are merged (or not).

That’s an oversimplified example, but it demonstrates how distributed revision control provides teams with tools for managing code.

GitHub is an online Git service. It provides all of the features of a Git server, as well as many others. And GitHub isn’t the only service. Two of its main competitors are Bitbucket and GitLab; both offer online Git servers and their own set of value-added features.

Git Without Github? It’s up to You

Git is the most widely used revision-control tool for many reasons. It’s a powerful tool that works on all major operating systems that look the same to developers whether they’re working alone or with a team via a Git server.

GitHub is a popular online service that’s become synonymous with open source and Git. Many public and private projects host their code there to use Git and GitHub’s collaboration tools.

But while you can’t use GitHub without Git, you certainly can use Git without GitHub.

This post was written by Eric Goebelbecker. Eric has worked in the financial markets in New York City for 25 years, developing infrastructure for market data and financial information exchange (FIX) protocol networks. He loves to talk about what makes teams effective (or not so effective!).

How Long Does It Take to Learn Python?

How long does it take to learn Python?

Well, how long is a piece of string? How much peanut butter is too much? Is this glass half-empty or half-full?

None of these questions has one correct answer. The answer to each depends on your opinion and your goals. And how long it takes you to learn Python depends on what you want to create with the language.

So, while I can’t tell you how long it will take to learn Python, I can give you deeper insight into the language and how it will suit your needs.

What Do You Need to Learn Python?

Python is a general-purpose language. You can use it for automating tasks such as backing up your computer, starting and stopping programs, and sending emails. It’s also good for web applications and trading stocks, currencies, or bonds.

Python supports both structured and object-oriented programming. That means that you can write your programs using two very different approaches—in the same language.

So, before you can determine how long it will take to learn Python, you need to define what you want to learn. Will learning the language’s syntax and basic constructs be enough? Or do you need to learn one of its specialized libraries like statistics, robotics, or science?

The real question isn’t “How long does it take to learn Python?” It’s “How long does it take to learn how to code for” whatever you’re trying to do.

Let’s take a quick look at the language and how it compares to others.
Continue reading “How Long Does It Take to Learn Python?”

7 Tips for Beginner Programmers

You’re just starting out as a programmer, so you’re looking for some tips on how to get started.

Maybe you’ve landed your first job. Or you’ve just finished school. Perhaps you’ve done what many of us before you (including me) did and simply said “I’m a programmer!” and got to work. Either way, congratulations!

Here are a few tips for beginner programmers that will help get you on your way to a new career.

There’s No Substitute for Getting Your Hands Dirty

You can read hundreds of books. You can watch thousands of hours of YouTube. But nothing makes you a better programmer than, well, programming. Stop preparing and start writing code that solves problems.

This practical experience needs to involve both of those activities, though.

Writing code is important, of course. Your goal is fluency: the ability to write code without having to think about writing code. You want to think in code. This comes from repetition. From putting finger to keyboard and cursor to editor.

Tips for beginner programmers: Your goal is fluency: the ability to write code without having to think about writing code. You want to think in code. This comes from repetition. From putting finger to keyboard and cursor to editor.
Credit: Pixabay.com

But problem-solving is just as important. Code kata and basic exercises do a lot to create fluency, but taking real-world problems and translating them into code is the critical skill you need to develop.

So, here’s the first of my tips for you beginner programmers: Find real problems and write code to solve them. Write a replacement for the ls command. Create a simple video game with your favorite language. Take a task that would benefit from automation and write something to address it.
Continue reading “7 Tips for Beginner Programmers”

What Is a Programming Framework?

One of the reasons that learning to program might feel like an overwhelming task is the sheer number of new words, terms, and expressions you come across. Today, we’re here to make your life easier by explaining one such term: programming frameworks. Specifically, we’re going to tell you everything you need to know in response to the question “what is a programming framework?”

You can think of a programming framework as a tool—or a set of tools—you use to make your life easier when performing common programming tasks. I know that might sound a little vague, but it’s hard to offer a more complete definition without going deeper into the topic. Luckily for you, “going deep into a topic” is our thing here at Make Me a Programmer.

What Is a Programming Framework In Simple Terms?

Here’s my definition of a framework:

A programming framework is a prepackaged set of solutions that solves common development problems.

Why do people use frameworks? We’ll go into that in the next section, but I can say that the No. 1 reason for using a framework is probably saving time. But as you’ll soon see, there are several other benefits you can get by leveraging frameworks.
Continue reading “What Is a Programming Framework?”

Best Programming Books for Beginners

What are the best programming books for beginners? This is a broad question. Programmers need a wide variety of skills, and the field you want to work in can have a significant impact on which ones you need. There isn’t one book, or even a list of books, that will teach you everything you need. Some skills can come from books, and some will only come from on-the-job training.

You need books that will improve your knowledge and skills regardless of what type of programming you’re interested in. I’ve put together a list of seven books that will do that for you! These books teach you basic skills that any programmer can use and, more significantly, how programmers need to think.

Let’s dive in.
Continue reading “Best Programming Books for Beginners”

What Languages Should Every Programmer Know?

It’s easy to get lost in the sea of programming languages. On top of that, there are some languages (I’m looking at you, JavaScript) that have a vast ecosystem of frameworks. Wikipedia has an exhaustive list of programming languages with several for each letter of the alphabet. I won’t count them, but there are at least 260 at a glance. There’s no way you can learn all of them. So, what languages should every programmer know?

Where to Start?

If you want to know where to start, you can take a few approaches. Of course, this depends on what you want to do in your programming career.

What languages should every programmer know?
Credit: Pixabay.com

If you want to build games, you should learn some common gaming languages (and platforms, too). For mobile app development, you would focus more on the languages used for iOS and Android development. Is data analytics your thing? It’s pretty hot right now! And if it is, you’ll want to learn data-centric languages, plus some languages that specialize in data analysis like R.

See what I mean when I say it depends on what you want to do? But if you don’t quite know where to begin, you might look at the markets. Are you interested in learning to code because it has a good job market? If that’s your game, then you might consider using the markets as your guide.

Two points to consider:

  1. The markets are always changing.
  2. Some languages are in demand because knowledge of those languages is uncommon.

Also, you can ask around. Of course, if you ask five different people, you’ll get five different answers. But, you can always take the ones that are mentioned more frequently and start there. I’ll share my own list and see what others have to say on the topic, too!
Continue reading “What Languages Should Every Programmer Know?”

What Non-Programming Skills Do Programmers Need?

As programmers or aspiring programmers, we often focus on the technical skills we need to build software. We work on improving our programming skills, picking up new frameworks, or reading technical books to improve our knowledge of computer science.

However, those technical skills will only get us so far. As with most careers, we need to expand our learning and also focus on professional skills. And actually, these skills will make the technical side easier, as we’ll have more clarity on what we need to do to solve problems.

In this post, we’ll go over what non-programming skills programmers need to use in our jobs.

1. Communication

First and foremost, we need to be able to communicate with our fellow programmers, analysts, product managers, and customers. Without clear communication skills, requirements get lost or misunderstood. Technical skills will only get us so far. We need to expand our learning and focus on professional skills. And actually, these skills will make the technical side easier, as we'll have more clarity on what we need to do to solve problems.As a result of poor communication, programmers might build the wrong solution to the problem. Or their solution might make things difficult or clunky for the user because the programmer didn’t understand the problem correctly.

A lot can go wrong with communication. And since communication is the most important skill that we’ll cover, let’s break it down further.
Continue reading “What Non-Programming Skills Do Programmers Need?”

Should Developers Write Documentation? Yes, and Here’s Why

Should developers write documentation?

Yes. Yes, they should.

That’s it. Everything you need to know! Come back next week for more helpful career advice for aspiring programmers.

Oh. You want to know why developers should write documentation? Fine.

Why Developers Should Write Documentation

Developers should write documentation because it makes it easier for both you and your coworkers to use your code. Well-written code is easy to read and understand. Documented code, on the other hand, is a gift to everyone—even to the coder that created it.

Writing documentation makes you a more valuable developer and will help your career. Documenting your code makes you a better developer and helps you design better systems. Continue reading “Should Developers Write Documentation? Yes, and Here’s Why”

How Many Hours Do Software Engineers Work?

The world of software development has a strange reputation, both for insiders and outsiders. One thing many people have wrong ideas about is how many hours software engineers work, or should work. I’d like to dive a little deeper into this subject: What is the reality and what should you do?

What Many People Think

Many people think that software engineers work almost all the time. When you ask about average work hours per week, numbers between 60 and 80 hours per week are not an uncommon response. This idea lives among both developers and non-developers. Among some developers, there is also a strong feeling that you can only be a great developer if you work this much.

How many hours do software engineers work?
Photo credit: Pixabay.com

I’m not sure where the idea comes from. Maybe it originated from the image of the asocial nerds that spend all their time sitting behind a computer. Or maybe the immense pressure that Silicon Valley startups have put on young developers created this idea. In some cases, developers like to cultivate this image out of some peculiar macho reasoning of what it takes to be a “real” developer.

Apparently, things have improved over time. A CNET article talks about how companies and individuals have evolved to more realistic work weeks and room for a personal life. Companies have also realized that overtime doesn’t necessarily mean developers will be more productive. And with the advent of working from home, developers can increase their productivity without crunching extra hours.

The Reality

The reality is complicated. Continue reading “How Many Hours Do Software Engineers Work?”

Do Programmers Use Mac or PC?

In this post, we tackle a question that troubles many an aspiring programmer: Do programmers use Mac or PC?

The question does have a short, straightforward answer. Here it goes: Some programmers use Mac, while others favor PCs running Microsoft Windows. Still others prefer to use one of the many Linux distributions. Last but not least, some use some combination of the options above.Some programmers use Mac, while others favor PCs running Microsoft Windows. Still others prefer to use one of the many Linux distributions. Last but not least, some use some combination of the options above.

Are you satisfied with this answer? I wouldn’t be. As it often happens, the short answer turns out to be too short. Despite being technically correct, it doesn’t tell the whole story. I bet there are more things you want to know about this Mac vs. PC thing. For instance, where does this trope come from? Why does the perception that developers disproportionately favor Macs exist? Are Apple devices really the best option for software developers? Where does Linux fit in?

These are the kinds of questions we’ll answer in this post. By the end of it, you’ll understand the role that your choice of platform actually plays in your software development career.

Let’s dig in. Continue reading “Do Programmers Use Mac or PC?”