Showing posts with label local git. Show all posts
Showing posts with label local git. Show all posts

Friday, February 17, 2023

Powerful GIT commands

 Git is a powerful and widely used version control system that allows developers to manage their code changes and collaborate with others. While it has a lot of features, some commands are more powerful than others. In this blog article, we'll go over some of the most powerful Git commands that every developer should know.


git clone

The git clone command is used to create a copy of a Git repository on your local machine. This command is extremely powerful because it allows you to access the entire history of a project, including all the previous commits, branches, and tags. This can be very useful when you want to work on a project or contribute to an open-source project.


git log

The git log command shows the commit history of a repository. It is a powerful command because it allows you to see all the changes made to a project, including who made the changes, when they were made, and what was changed. This can be useful for troubleshooting, debugging, or tracking down issues in your code.


git branch

The git branch command is used to create, delete, or list branches. It is a powerful command because it allows you to work on multiple features or bug fixes at the same time without interfering with each other. This can be useful for teams or individuals who need to work on different parts of a project simultaneously.


git merge

The git merge command is used to merge two or more branches into one. It is a powerful command because it allows you to combine changes from different branches into a single branch. This can be useful for integrating new features or bug fixes into your main development branch.


git rebase

The git rebase command is used to apply changes from one branch to another. It is a powerful command because it allows you to update your branch with changes from another branch while keeping your branch history clean and easy to follow. This can be useful for keeping your code up-to-date with the latest changes made by other developers.


git reset

The git reset command is used to reset your branch to a previous commit. It is a powerful command because it allows you to undo changes that you have made to your branch. This can be useful for fixing mistakes or errors in your code.


git stash

The git stash command is used to temporarily save changes that you have made to your branch. It is a powerful command because it allows you to switch between branches without losing your work. This can be useful for working on multiple features or bug fixes at the same time.


In conclusion, Git is a powerful version control system that has many features and commands that can help developers manage their code changes and collaborate with others. The above commands are just a few of the many powerful Git commands that every developer should know. By mastering these commands, you can become a more efficient and effective developer.





Sunday, June 14, 2020

Revoke/Revert Git Commits from Remote or Local Repository || GIT Users must know

Developers use source control management tools like GIT or SVN daily and commits there code frequently(frequent commit is the good practice though) to avoid losing the code.
But there may be a circumstances we tend to commit the changes which is not relevant or wrong commits. In order to overcome this scenario GIT provides the powerful commands to revoke the changes made locally or even pushed to remote.
Lets see the commands to rollback the GIT commits from Local and Remote branches.
Below are the typical GIT commands to perform the GIT commits

#incrementally add the changes to GIT index before commit.
git add <filename> or git add * 

#Commit the added index to local repository
git commit -m "Good developers write meaningful commit messages"

#Logs all the commit logs of the repo
git logs

#List changes or index added on your workspace
git reflog


#Remove files added to index before commit
git rm <filename>

#Undo the Local commits
git reset --soft HEAD^     # Use --soft if you want to keep your changes
git reset --hard HEAD^     # Use --hard if you don't care about keeping the changes you made

So far we had seen the local commits and roll backing the changes, Now if the Changes are pushed to remote repository and undo the changes Lets wee whats needs to be followed.

#You are reverting the changes from the public repository , You should be very careful when executing the below command.. Below command is forcing the old reference as the recent change in the GIT.

git push -f origin last_known_good_commit:branch_name

Diagram depicts the GIT commit to local and remote workflow


Serverless vs. Kubernetes: A Beginner's Guide

Serverless vs. Kubernetes: A Beginner's Guide Trying to decide between serverless and Kubernetes? Here's a simple breakdown: 🔹 Choo...