freeCodeCamp.org
In this video we are going to learn about the importance of Git and
GitHub, as well as how to use them. We will cover basic concepts such
as repositories and branching, in addition to more intermediate topics
like merging, forking, and committing. By learning Git, you can gain
more proficiency with the command line; for example, the 'CD' command
stands for 'Change Directory' and is equivalent to double-clicking a
folder in the desktop. Git tracks changes made to your code over time,
which you can then upload to a remote repository like GitHub or
Bitbucket. Once you have made changes locally on your computer, you
can tell Git to track them through the 'Add' command, allowing you to
commit your changes and store them online.
Markdown is a great way to format text in files. For example, I'm
creating a basic markdown file called a readme, which is commonly
found in many projects. If you are using Mac or Linux, you should
already have Git installed. If it is not installed, I recommend
checking out the tutorial by Atlassian. Additionally, you need to get
a code editor like Visual Studio Code so you can access the terminal
and pull the repo from GitHub. After that, you can work with the code
locally and make customizations to your preferences. Lastly, there is
a hidden folder which you may find helpful.
Git is a version control system that allows you to store files that
record your code changes over time. To save new files, you must tell
Git to track them using the 'git add' command. After the changes are
'staged', we can make them live on GitHub by using the 'git push'
command. In order to do this, we must prove to GitHub that we own our
account by using a private key. Every time we want to connect to
GitHub or use our account, we must start the SSH agent and modify the
SSH config file if our version is 10.12.2 or later.
Creating a new repository on GitHub is relatively straightforward, and
can be done by running an SSH add command from your terminal. After
that, you'll be able to refresh the page and see your code changes
live on GitHub. You may find that Git doesn't recognize a remote
repository, in which case you should create one. Once the connection
is established, you can use the GitHub web interface to write code and
push it to the remote repository. If you have any questions or issues,
feel free to leave them in the comments below.
When working in a repository, each branch has its own changes and
commits that are not known to other branches. This is extremely useful
as it allows developers to create new features without disrupting
existing code. For example, when working in the terminal inside the
demo repository, you can use git checkout to switch between branches
and git checkout -B to create a new branch. VS Code also offers
autocompletion when typing instructions, which can be very useful as
it reduces the time spent typing out long commands when working with