Home Interests WWW

How to commit and push in Git

howchoo   (467)
August 17, 2023
3 minutes

Share

Interests
Posted in these interests:
computers • 2 guides

Git

git • 5 guides
github • 1 guides
webdev • 10 guides

WWW

www • 2 guides

This guide will show you how to properly commit and push your work in Git. It is assumed that you have Git installed and that you’re currently in a clean master branch.

1 – Create a task branch

With a clean master branch checked out, you can create a task branch by typing:

git checkout -b task_branch

where the task_branch is the name of the branch you want to create. By using the -b option it will both create a new branch and check it out.

2 – Do your work and commit

As your are doing work you can commit regularly, and you must also commit when you are finished with your task. You can commit by typing:

git commit -am "commit message"

and you should leave a detailed commit message describing the changes you made.

3 – Merge your work into master

Now that you’ve finished your task you need to checkout master and merge your work. To checkout master simply type:

git checkout master

and to merge your task branch type:

git merge task_branch

where task_branch is the name of your branch.

4 – Push the master branch

Now that your work is merged, go ahead and push the master branch by typing:

git push origin master
NEXT UP

How to Set up Git Tab Completion

howchoo
howchoo   (467)
November 26, 2023

Tab completion, or auto-completion, is essential if you’re using Git on the command line. Tab completion is a nice feature of many shells that allows you to complete a word by hitting tab. In this case, we want to be able to use tab completion for things like branches and tags in git. Fortunately, setting

Continue Reading

howchoo

 467 guides

Introducing Howchoo, an enigmatic author whose unique pen name reflects their boundless curiosity and limitless creativity. Mysterious and multifaceted, Howchoo has emerged as a captivating storyteller, leaving readers mesmerized by the uncharted realms they craft with their words. With an insatiable appetite for knowledge and a love for exploration, Howchoo's writing transcends conventional genres, blurring the lines between fantasy, science fiction, and the surreal. Their narratives are a kaleidoscope of ideas, weaving together intricate plots, unforgettable characters, and thought-provoking themes that challenge the boundaries of imagination.

Discover interesting things!

Explore Howchoo's most popular interests.

Explore