Using Git Terminal to update Source Control

Here's another note to myself, as well as for others who may just be using Git through the terminal for the first time.

Git is the original source control of Github Desktop application, except that it makes you look a lot like a hacker when you're using it. Oh, and Pull & Push makes more sense now: You PUSH your changes into the master branch, and you PULL your changes from the master branch into your local repo.

Let's say that you modified your project slightly on your project, and you're wanting to commit it, merge it and push it into the master.

To update your work from the master branch

  1. Before starting any work, always go to git terminal, open up the directory.

  2. Always type in "git status" to check for the master branch.

  3. Then, type "git pull".

  4. Make sure that your branch is up to date! If not, contact the programmer for help.

To upload your work to the master branch

  1. Open Terminal.

  2. Get to your destination. In this particular project, I need to get into where my project was saved, and where Terminal is referring to this project from. Documents -> Beachcomber -> Beachcomber. I can do this by typing into terminal:

13.png

"cd documents" ->  "cd beachcomber" -> "cd beachcomber"

3. Type "git status" to check out what's going on in your current project.

1.png

4. Whoa! That's a lot of red. But don't worry! That means that your changes are simply not yet committed yet. The instruction says to type "git add file" to update what I want to be committed, and "git rm file" to remove what I don't want to be committed.

2.png

5. Here is a quick tip for committing these files. By using the "*" star, you can include all files that share similar names. Right now, I see a lot of Beachcomber_WwiseProject/GeneratedSoundBanks... files. Even though they're all ending in different file formats, a lot of them share the same name up to that point. So I can type in "git add Beachcomber_WwiseProject/GeneratedSoundBanks/*" Notice the star at the end there. It's very important and will save you lots of time. BEWARE though, if you're adding or removing files, using * will add or remove ALL files that share the same naming convention, and might accidentally add or remove files that you didn't want. ALWAYS read over all of the files before using the *.

6. You see all these .meta files? They are generated but don't necessarily need to go into your master branch. Simply ignore them. Don't try to remove them.

4.png

7. Once you are done with your adds, type in "git commit -m "message"". Make sure to type in the message, otherwise, you won't be able to commit. Don't forget the space between the -m and message.

5.png

8. Now that you've committed, you're ready to push out the changes into the master branch. Go ahead and type "git push". When you do it, the terminal will ask you for an RSA key. Your programmer should know this. Type it in, and watch as you merge your stuff into the master branch.

9.png

9. And that's it! You have successfully added your changes to the master branch.