Bootcamp

From idea to product, one lesson at a time. To submit your story: https://tinyurl.com/bootspub1

Follow publication

Member-only story

Git commands nobody has told you

Git plays an important role in our daily routine as software engineers, especially working in a team. It helps developers to collaborate on projects no matter of the scale. There are a lot of git commands available, some of them developers use every day, others aren’t use that widely but it’s worth to know about their existence.

In this article we are going to see some commands which aren’t required to know but will definitely help us become git guru.

Add and commit in one command

One of the most used command in git is git add, followed by git commit.

git add .
git commit -m "commit message"

Most of the time will want to add all changed files. Instead of writing both commands we can combine them in one using the -am flag, which is doing both git add . and git commit.

git commit -am "commit message"

Copy changes from another branch

There are some scenarios where we have to add changes to more than one branches, for example if there are two versions and we support both of them, we should commit changes to both branches.

Let’s have two branches, branchA and branchB. Instead of committing in both branches manually, we can use git rebase command.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Bootcamp
Bootcamp

Published in Bootcamp

From idea to product, one lesson at a time. To submit your story: https://tinyurl.com/bootspub1

Svetloslav Novoselski
Svetloslav Novoselski

Responses (23)

Write a response