so hey there we are meeting again today so as i told in previous blog now we will discuss about the rest of the topics so lets jump into it
as we discussed in previous blog most known git commands now we are curious about the less known git commands
less known git commands :
One of the most delightful git commands is git stash. It keeps all your changes both to tracked files and in your working tree, stashing them away so that you can use them later. Git stash is temporary storage. With it, you can continue working where you left off whenever you are ready. Hence, you will have a clean working tree and can start working on something new. Also, note that git stash will never touch your untracked and ignored files.
The git rebase command is used for moving or combining a range of commits to a new base commit. In other words, it can change the basis of the present branch from one commit to another and make the branch look like it was generated from another commit. Note that even if the branch looks identical, it is made of entirely new commits.
This command is primarily used for keeping a linear project history.
The git diff command is used for comparing the changes committed in Git. This command will help you take two input data groups outputting the modifications between them. When you execute this command, it runs a diff function on the data source of Git. You can use it in compound with the git status and the git log commands.
Git reset is another powerful command which allows undoing your changes easily. This command is generally used for returning the entire working tree to the last committed state. It will discard a private branch commits or throw away the changes that have not been committed. The git reset command will also help you to unstage a file in Git.
Generally, in Git every command allows undoing some changes, but only git reset and git checkout can be used for manipulating either individual files or commits.
Git blame is simply a great tracking command. It is aimed at showing the author information of every line of your project’s latest modified file. Hence, you can use it to find the author’s name and email address, or the commit hash of the last modified source file.
The next rarely used but super-useful command is git-am. You can use it for applying a series of patches from a mailbox. It allows splitting mail messages in a mailbox onto commit log message, authorship information, and patches. Git-am applies all of them to the current branch.
Git cherry-pick is robust and not a famous command at the same time. It represents an act of picking a commit from a branch and applying it to another one. It can be related to the powerful Git tools used for undoing changes. Let’s say you have accidentally made a commit in the wrong branch. This command will let you switch to the desired branch and cherry-pick your commit to the place it should belong.
What is git branching
Branching is a feature available in most modern version control systems. Instead of copying files from directory to directory, Git stores a branch as a reference to a commit. In this sense, a branch represents the tip of a series of commits—it's not a container for commits this is like parent child relation where the child branch will inherit the parent when the work is done it will merge into parent to create a unified branch.
So the last part is commit messages
what is commit message
The commit command is used to save changes to a local repository after staging in Git. However, before you can save changes in Git, you have to tell Git which changes you want to save as you might have made tons of edits to keep the record of what are the work you have done we do commit messages.
what are good commit messages:
1.feat: The new feature you're adding to a particular application
2.fix: A bug fix
3.style: Feature and updates related to styling
4.refactor: Refactoring a specific section of the codebase
5.test: Everything related to testing
6.docs: Everything related to documentation
7.chore: Regular code maintenance.[ You can also use emojis to represent commit types]
so these are some commit messages so whenever we commit changes it is a best practice to write commit messages which helps us and others to understand.
so this is it for todays blog i hope you enjoyed well and got some grasp of good knowledge so lets meet in another blog with some information.