Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Time to git up and running

Info

Ask 100 software developers what you need to know as a developer, and you'll get 100 different answers. Except for one thing: 99 of them will tell you to learn about Git.

Git and version control are universal nowadays. It's not hard, but it can be slow and confusing when you're a beginner. Let's alleviate that by having you work with the tool!

What you will be working on

Today will be all about working with Git. The goal is to use the tool until it becomes more natural. The lab instructions will be vague on purpose. The aim is for you to sift through documentation and resources to find out what the next step is.

A word of warning

It's incredibly easy to have AI tell you what to do next if you get stuck. That defeats the purpose of this exercise. Relying on AI for help is like learning a new language by using Google Translate instead of following the exercise steps.

The learning is in the doing. If you don’t take the time to figure things out yourself, your long-term learning will suffer. IF you do end up completely stuck, ask in Slack or Dircord!

Setup

Make sure you have Git installed, together with VS-Code.

Throughout the lab, we will work in the terminal to run the Git commands.

Resources

Lab instructions

Let's first set everything up:

  1. Make a new repo on GitHub.com and clone it to your own computer. If it is your first time doing this, you might have to create an SSH-key and add it to GitHub

  2. In your now local repo, open in up on VS-Code. From here, create a new file named news.md, add a "Hello World" inside and commit that file with an appropriate commit message.

  3. Once you've committed the news.md file, push your commit to the remote repository on GitHub.

Your change should now be available on GitHub. Let's branch out to make a change!

  1. In the news.md file, add anything interesting you've learned about recently. Once added, commit!

  2. Create a new branch named feature/update-news. Switch to this new branch. This is where you will make more changes to your news.md file.

  3. In the feature/update-news branch, add another paragraph in the news.md file (maybe link to a news article you've read?). Commit!

  4. Now, push this new branch to your GitHub repository. Then go to the Repo online and make sure it's there.

  5. Online at GitHub, create a Pull Request (PR) from the feature/update-news branch to the main branch. This will merge the changes from your new branch to the main one.

  6. Review the changes to make sure whoever did the changes did not do anything wrong and then, merge the pull request.

  7. Now, go back to your local environment. Switch to the main branch and pull. Your changes should now be available.

What if we have something not ready for commiting?

  1. Make a change to news.md but don't commit it. Stash these changes!

  2. Switch to another branch or create a new one. Here, make some different changes and commit them.

  3. Now, go back to the previous branch (hint: git checkout -) and restore your stashed files.

Conclusion

Congratulations! You've just performed some very common Git tasks. From cloning a repository to making changes, committing them, working with branches, creating PRs, and using stash.

Remember, the more you practice, the more comfortable you'll become. And, just like any other skill, consistency is key. So, keep "gitting" at it!