Some useful GIT commands for beginners
GIT is an unavoidable thing for everyone who is working in IT. To keep the code safe and distributed between multiple resources that been achieved with the help of GIT.
What is GIT?
Git is a distributed version control system that tracks changes in any set of computer 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.
I know many of them are very professional at using the GIT commands and many of them are not. I thought to share a list of GIT commands for those who have just started to use the GIT and who are feeling very difficult to remember all those commands when it is required.
-
git init
Create a new local repo.
-
git clone
Cloning an existing repository and to create local working directory.
-
git diff
Git diff command will show the changes which are not yet staged.
-
git status
To view the list of modified and untracked files using this command.
-
git add.
Add the modified and untracked files into stage for commit.
-
git add<file-name>
Stage a particular file for committing.
-
git commit -m "<message>"
Committing the previously staged files with message.
-
git commit -a
Commit all local changes to tracked files, not the new files.
-
git commit --amend
convenient way to modify the most recent commit. It lets you combine staged changes with the previous commit instead of creating an entirely new commit. It can also be used to simply edit the previous commit message without changing its snapshot.
-
git log
Get all the change history of a branch.
-
git checkout <branch>
Switch to a branch update the working directory.
-
git branch <new-branch>
It is used to create new branch.
-
git branch -d <branch>
Delete a branch from local.
-
git fetch <remote>
This will fetch all the branches from remote repository. This Command brought other branches of the repository that were all created by other developers.
-
git pull <remote> <branch>
Fetch remote version of a branch that contains the latest changes.
-
git push <remote> <branch>
This will be sending the locally committed changes to the repository, after this any of your developers can have a look at your changes.
-
git merge <branch>
Merge the specified branch into the current branch.
-
git rebase <branch>
Rebase your current head onto the specified branch.
-
git revert <commit>
Create a new commit to revert to the specified commit.
-
git rev-list --count HEAD ^<branch-name>
Get number of commits have done against to the branch.
-
git reset
git reset is a powerful command that is used to undo local changes to the state of a Git repo.
Check the one example of squashing the commit using git reset
If you feel this is really useful, please save this URL to your notepad or bookmark for future use. Also share across to your colleagues.
More Stories
Cross-Origin Resource Sharing (CORS) is a security feature that lets a web page from one domain request resources from a different domain
SVG elements will not add the accessibility atttributes by default, so that will fail to describe by itself, and the NVDA and other screen reader required these attributes to work.
Despite being acquainted with git, many developers struggle to resolve these conflicts due to a lack of understanding of how to pull the conflict details into their local machines.
Firebase Authentication is one of its gems, allowing you to add user authentication effortlessly. It's secure, reliable, and comes with Google's seal of approval.
Why am I getting an auth/invalid-api-key error when setting the Firebase values in the environment variable on NextJS ?
Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none.
Easist way of downloading the SVG file as PNG file is done using javascript snippet
The importance of the http response headers are highly needed to protect the websites from hackers. If you poorly managed the response header then one day the website will be compromise to the hacker.
An HTTP header is a response by a web server to a browser that is trying to access a web page.
Application Insights is an feature of Azure Monitor and it provides application performance monitoring features. APM tools are very useful to analyse applications from development, testing and production release.
A lazy function lets you defer the loading of a components code until it is rendered for the first time. Before, it will remain in the bundle. So that we can reduce the load of the application.
We covered most asked questions for Javascript interview and their answers
we are displaying these emojis with the help of ASCII code and it is not that easy to remember because its a mix of numeric and special characters.
ES6 or the ECMAScript 2015 is the major edition of ECMAScript language, it introduced several new features which are very special to the developers
what are the new features among the various versions of ECMA script and what is difference
We can squash the number of commits from a git branch
Your focus-trap must have at least one container with at least one tabbable node in it at all times, when using dialog or modal in ReactJS or other front-end framework
Writing test cases for modal popup in jest
Cannot read property location of undefined, this is an common test cases error in react jest while using useLocation hook in your react component
There is a common problem when parsing the markdown file the ID attribute is missing in the element, here we found a solution to fix/overcome
It is basicall demonstrating how to find the fibanocci, amstrong, prime numbers and pyramid pattern using javascript.
Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents.
There are few development tips for Javascript array operation, these tips will reduce your development time.
For every website the Sitemap will be playing important role for SEO performance. In Ecommerce and other consumer websites also SEO have important role for developing their revenue.
This question is very usual, to get solve this issue by using the browser property user agent to check whether the device type.
What are the possible ways to create objects in JavaScript, The traditional way to create an empty object is using the Object constructor. But currently this approach is not recommended.