Git and Git Hub
What is the GitHub Flow?
(1) Forking Add a copy of someone else's GitHub repository to your GitHub account. This forked repository is not perfectly identical, but it includes all of the same source files, issues, and commit history. (2) Cloning To make a local copy of a fork, you'll clone the repository. This will save the code on your machine so you can edit it. (3) Editing Make your edits by using the text editor of your choice. (4) Adding/committing Remember, you're editing the code on your local copy of the repository. We know that any time we do this, we need to use some very important Git commands so that our local copy is protected if we goof up. (5) Pushing Once you've committed these changes, your local repository will differ from your remote repository. To update your remote repository on GitHub, you have to push those changes using the git push origin master command. (6) Submitting a pull request At this point, your local and remote repositories contain the changes you've made. If you want to share these changes with the original repository owner, Joyent, you can submit a pull request. A pull request effectively says, "Hello, maintainer of Project X. I made some changes here in my forked copy, and I think they're good ones. You should add them to your repository."
What is branch in GIT?
A version of the repository that diverges from the main working project. Branches can be a new version of a repository, experimental changes, or personal forks of a repository for users to alter and test changes.
What is a GIT Repository?
After you install Git, you can initialize it onto a project to create a new Git repo. A Git repository is the .git/ folder inside a project. This repository tracks all changes made to files in your project, building a history over time. Meaning, if you delete the .git/ folder, then you delete your project's history.
What does it mean to say that GIT is a distributed version control system?
Git is a distributed version control system meaning rather than using a centralized server to store and manage the source code, it creates a local repository which is nothing but the clone of the central repository which allows developers to make changes of the whole thing locally. The local repository consists of everything from version histories to branches to metadata, everything. On the other hand, when developers commit to subversion, they send all the changes back to the central repository.
What is GIT?
Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different systems). By far, the most widely used modern version control system in the world today is Git. A staggering number of software projects rely on Git for version control, including commercial projects as well as open source.
What is Git Hub?
GitHub is a company that's famous for the platform it built to manage Git repositories in the cloud. On GitHub, developers can share their code, comment on it, and review changes. It's an implementation of the same Git software you installed on your computer, but it also comes with some additional features. * In a lot of ways, GitHub is like Dropbox. * You have a folder in the cloud — your remote repository — that syncs with your computer. You can share this remote repository with others, grant them special permissions, and view different versions of your files.
What does the git add. command do?
Sometimes, you'll want to save all of the changes to files that have been made inside your repository. Instead of specifying each file, you can write git add . , which will add all of the files in the working directory to the next commit. Proceed with caution when using git add ., as you could accidentally add files with sensitive information.
What does the git add command do?
The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. The command is add, but we describe the operation by saying that the file has been "staged." In other words, it has been added to the list of changes that will be officially saved with our next commit. The files on this list aren't final, and any of these changes can be removed, or "unstaged."
What does the git init command do?
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you'll run in a new project. Do not execute this command in your home directory! It'll make working with any other repositories very difficult. Use pwd to check your location if you're unsure.
What is the git status command ?
The git log command displays committed snapshots. It lets you list the project history, filter it, and search for specific changes.
What does git log do?
The git log command shows a list of all the commits made to a repository. You can see the hash of each Git commit, the message associated with each commit, and more metadata. This command is useful for displaying the history of a repository.
What does the git status command do?
The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git. Status output does not show you any information regarding the committed project history. For this, you need to use git log.
What does the touch command do?
The touch command can create a new empty file. Ex: touch post.txt creates a new text file named "post"
What is initializing in GIT?
To take advantage of Git superpowers, we have to add a hidden directory called .git/ to our project directory, which contains all of the data Git needs to operate. This is called "initializing."
What is a Version Control System?
Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time. Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.
What are some advantages GIT offers its users?
Git offers a variety of advantages to its users, including: *Rolling back changes. *Rolling forward changes. *Mitigating competing versions of the same file. *Tracking changes for multiple files. *Recording only the changes made rather than saving entire separate versions of each file. *And many more...
What are some other examples of Version Control Systems?
Some popular version control systems are Git (distributed), Subversion, CVS, Perforce and many others.