Staging and snapshotting are important topics because these commands will be used by us daily.
Installation and setup were covered in the previous log.
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. Let's have look at only commands that required to stage and commit to your working branch.
Working with Git stage and commit
git status
- show modified files in the working directory.
git add [file] (or) git add .
- you can add the file one by one to the stage or use ( . ) to add all your files at once to the stage.
git reset [file] (or) git reset .
- unstage a file while retaining the changes in the working directory or reset all files using ( . ) at the end.
git diff
- check the changes made compared with the previous commit for the unstaged files.
git diff --staged
- check the changes made in stages files before commit.
Commit your code
git commit -m "[descriptive message]"
- this command commits your staged files with changes to the repository, you should give a descriptive message about the commit.
Happy Coding 👾
AMA on Twitter
Top comments (0)