

See, the staging area is one of Git’s more unique features. The main function of the git add command is to promote pending changes in the working directory, to the git staging area. This allows other team members to access a set of saved changes. What git push does is send committed changes to remote repositories for collaboration.

In addition to git add and git commit, a third command called git push is essential for a complete and collaborative Git workflow. There are some samples below so you can see what this would all look like. You can also use the git reset command to undo a commit or staged snapshot when/if needed. Remember, git commit is saving changes in Git. Once you are happy with the staged snapshot that is provided you commit it to the project history with git commit. When you are satisfied, or ready, to save a copy of the current project as it is, then you stage changes with git add. So in simpler terms, it lays out like this: Step 1: Edit Files in the Working Directory.Įdit all the files you have been working on and get them ready to “commit.” Step 2: Use Git Add Comand

See, developing a project on Git involves the basic edit/stage/commit pattern. Essentially, these commands are the means to record versions of a project into the repository’s history. These are two commands that every Git user should know and understand. The git add and git commit commands compose the fundamental Git workflow.
How to do version control using git on mac how to#
Let’s take a look at how to save changes in Git. This will prevent Git from saving changes to ignored content. The stash operates on the working directory and provides extensive options.įurthermore, a Git repository can be configured for certain files and directories. Git also has an additional saving mechanism known as “the stash.” Essentially, the stash is a storage area for changes that are not ready to be committed. Git operates differently, as saving changes in Git involves committing an operation that in turn, acts on a collection of files and directories. Traditional saving is thought of as a system operation used to overwrite an existing file or to write a new file. What is a Commit?Ī “commit” is in fact, the Git version of saving. Today, I am going to show you how to save changes in Git using the “commit” command. When you work with a program like Git, or other version control systems, “saving” changes is usually not as traditional as saving changes would be in something like Word or more traditional file editing applications.
