Git scenario cheat sheet

Merge
git merge new_feature
Let's say, we want to copy all the code from
new_feature
branch intodev
branch.In such a situation, first, we have to
checkout
indev
branch then we can execute the above command.The above command means bringing all the changes from
new_feature
branch into the current branch.Note: always pull before any merge i.e. after
git checkout test
do a pull requestgit pull
after that dogit merge new_feature
Remote branch
You have a lot of branch in you remote but when you did git clone <repo-url>
and git branch
. You can only able to see main
branch. Now you want to see all the branch in your local machine.
for branch in `git branch -r | grep -v '\->'`; do
git branch --track ${branch#origin/} $branch
done
git fetch --all
Subscribe to my newsletter
Read articles from Md. Kaiyom directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Md. Kaiyom
Md. Kaiyom
To live in hearts we leave behind is not to die