What does it mean to be a Git project?

Question

This exercise says we’re turning sorcerers-code into a Git project – what does this mean?

Answer

sorcerers-code is an existing directory with some files already in it, so it’s already a project of sorts. But! It’s not yet a Git project – better known as a Git repository, or repo.

When you use git init and initialize a repo, you’re officially making a Git project and can now make use of all the git commands in the world! If you’re not inside of a git repo, you won’t be able to use git commands and the terminal will complain to you about it.

20 Likes

Git is a version control system. It is on the command line. So when you turn it into a Git project, you are essentially making your project able to be compatible with Git by getting git commands imported to the command line.

29 Likes

I had two quick doubts. I request you to clear them out.

  1. While a project goes live after a UAT, the Clients sometimes ask for the code-base and a thorough understanding during hand-over. Is it true that Github comes handy at that time, making it easy for the Developers to share all their work which can be publicized to the Clients only be sharing their Repo Link with the Clients? As I am just starting to know about Project-Flow controls, my point of view might not be the case.
  2. When do the developers use Git and when do they use Github? As of now I have seen that Git is a CUI based application which colabs with Bash. How is Github different from Git?

Yes. GitHub allows you to share your repositories with other developers, clients, and anyone else only by sharing a certain link

Even though they share a similar name, they do have major differences. Git is a version control system, meaning it keeps track of the changes made to your project over time and allows you to do many things such as: restore a previous version of your project, create a new version, etc.

GitHub, on the other hand, allows you to host your git repos. Of course, GitHub is way more powerful than that, but that’s basically what it does (in simple terms)

6 Likes

And don’t forget the Git repository is hidden on your Mac (and in Windows) - this is for good reason. Source control is taken seriously, and it’s important to ensure that files are not modified outside the safety of Git commands. So it may be confusing to look in your working directory (where you can physically see the code you’ve been working on), but not “see” the Git repo. But it is there! You can either ask your OS to show hidden directories, or fire up bash / zsh and from your working directory type cd .git

Voila!

On my Mac this is what I see:

/Users/<me>/Development/Codecademy/.git

and an ls -l command reveals:

-rw-r--r--    1 <me>  staff     9 10 Dec 20:08 COMMIT_EDITMSG
-rw-r--r--    1 <me>  staff    23 21 Sep 15:05 HEAD
drwxr-xr-x    2 <me>  staff    64 21 Sep 15:05 branches
-rw-r--r--    1 <me>  staff   137 21 Sep 15:05 config
-rw-r--r--    1 <me>  staff    73 21 Sep 15:05 description
drwxr-xr-x   12 <me>  staff   384 21 Sep 15:05 hooks
-rw-r--r--    1 <me>  staff  8849 10 Dec 20:08 index
drwxr-xr-x    3 <me>  staff    96 21 Sep 15:05 info
drwxr-xr-x    4 <me>  staff   128 21 Sep 15:06 logs
drwxr-xr-x  187 <me>  staff  5984 10 Dec 20:08 objects
drwxr-xr-x    4 <me>  staff   128 21 Sep 15:05 refs

Hope that helps!

10 Likes