Avoid The Pain Of Redoing Your Work By Saving Everything In Git

We’ve all done this: You’re making changes to your program and after days of work, it’s not what you expect. So you throw it all away and try something new. It’s only later that you realize that you could use some of that early code after all. But it’s gone now. Or even if you did save it somewhere, you don’t remember where. And how much work will it be to add it in with your new changes. Maybe you should just forget about it and spend time writing it again. Who knows? It should be faster the second time, right?

Let me show you a better way to keep track of changes. Git is an easy and powerful source code control system used by major companies for a reason. You can use it for small projects too. You can track all your changes including work that you decide not to use. And it makes it easy to figure out what needs to change if you want to include those changes after all.

The first thing to learn is how to install and properly configure Git.

  • There’s a couple options to be aware of:
    • Command line paths will let you run git commands from any of your projects.
    • And line endings become really important when you work on the same project with different kinds of computers. Get this wrong, and Git might think you’ve changed the whole file instead of just a few small lines.
  • Configuration is quick and easy and should be done right away.
    • There’s global configuration that applies to all your repositories. There’s more on repositories in just a moment.
      • User name and email.
      • Which editor to use.
    • And configuration that’s specific or local to each repository.
      • Remotes let you work with the true power of Git by letting your repository work with other repositories.

Repositories are where all the tracking and source code control take place. You’ll learn how to:

  • Create new repositories.
  • Clone a repository from another repository.
  • Fetching remote changes and pushing your changes back to your remote are how you pick up other people’s work and get your changes included for others to use.

Adding files and staging let you get your changes ready to be recorded.

  • Sometimes, you might want to ignore files. Usually you’ll need to do this for temporary files or for files that get created from other files. You only need to include files in Git that are important. And a file that you don’t actually make changes to is usually not something you need to track in Git.

Committing changes is where you can store your work in Git so it’ll be there when or if you ever need it again.

Status is your friend and will tell you what the current status of your repository is. You can use this to remind yourself what you were working on last.

Branching is super easy in Git. This is what lets you split your work so you can try new things. It’s also the best way for you to work with a group of other developers. You can each keep your changes in your own branch without affecting anybody else until you’re ready.

Merging can be a real torment with other source code control systems. But not with Git. Usually, you won’t even notice this. And Git makes it easy to handle when you need to. For example, if you and another developer both change the same line of code, then how is Git supposed to know which change is correct? Or maybe both changes are correct. This is called a merge conflict and you’ll have to decide how to handle each conflict.

And pull requests are a great way to let other people see your proposed changes before they become part of the project. You can get feedback and suggestions for improvement. Then you can make additional changes based on the comments from other developers. All of your original changes and modifications become available for review and eventual merging when you’re done.

Find Available Dates

Once you purchase one of the classes, you can reserve a spot in any of the upcoming dates for that class. Use the button below to easily search for the next available dates.


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

You may also like…