No Preview

Rizwan Khan

Posted on 3 October 2021

Git for Software Developer

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. [Wikipedia Ans]

For Every change in your code required a commit. ok whats commit? So confusing....!

git is a version control system

It works in 3 basic steps

1 - Write code in your working Tree(just a fancy word basically i am talking about all your project files) and add them in staging area.

2 - Now commit your staged files

3 -Finally push your changes to the remote repository

Accidently you commited something in your local repository which you dont want to go in remote repository

you can reset your head

whats head ?

Again a fancy term that reference to the currently checked out commit.

Now Accidently you commited something on your remote repository

after push check your git log by donig git log

It will show you all the previous commits. Now count your commits. let say you just want to go back to your previous commit

Git Merge

Now you may create many branches for any reason but at the end you have to merge the changes from one branch to another

To create new branch

git checkout -b branch_name

Now add some changes

Adding changes done

code puhsed

Now its time to merge

Suppose you have created a branch feature/branch_A from master branch

Another way of merging code is Rebasing

if conflicts come then resolved and commit it and then do this

Rebasing is good for local repositories not for remote repositories

Cherry Pick

cherry pick is very useful if you want pick specific commits from a repository




No Preview

Rizwan Khan


Coding is an art and I love art

Explore more similar Post