Git bit-by-bit (3 Part Series)
Git is Source Control Management Software. It is a project management tool, with the goal of maintaining a digital projects history. It does this by tracking changes of the contents within a folder/directory. It also makes it easy to share projects remotely, across the internet, without having to transfer the entire project.
- Location where changes are tracked.
- Set of changes to apply to the projects history.
- A collection of commits.
user:~/project/tutorial$ git init
- Creates a new Git repository in the current location. The repository will contain one branch, named "master" and no commits.
- See git-init
user:~/project/tutorial$ git add .
- This tells Git that you would like to track the history for all files and folders within this directory.
- See git-add
user:~/project/tutorial$ git commit -m "Initial Commit"
You now have a repository that contains:
- Any files within this folder.
- A "master" branch.
- A single commit with a message of "Initial Commit".
In order to add more changes, you should repeat the second and third commands any time you make changes to the contents of the folder.
Note: Make sure you change the message for your commits, because that will be the quickest way to tell what you changed with the commit.
user:~/project/tutorial$ git revert <commit>
- Undo the changes recorded within a commit. Does not erase the original commit, merely undoes the changes that were recorded.
- The commit must be done through a reference. You can find the hash(ID) for a commit by running "git log". You cannot specify a message.
This article is intended to be a quick and dirty introduction of the most basic concepts and commands to get up and running with Git. How to start a repository, how to add history, how to undo history. You can check back on this series for more in-depth guides in the future. As well as follow the links provided below for more information.
- Git Everyday for a more comprehensive guide from the maintainers.
- Git Reference the reference manual for Git.
- Github - Hello World for how to get started sharing your projects with the world.
Haven't signed up yet? 🤯