Chris Mendez in For Developers, Tools for Software Engineers, Git

Git: Creating a Branch during Agile Sprints

Here's a tip for new developers learning how to use Git for short sprints. The first step is to create a branch.

Step 1 - List Branches

List all of your existing branches.

git branch

Step 2 - Create a New Branch

Add a new feature by branching code.

git branch [name_of_your_branch]

Step 3 - Commit Changes

Switch to the branch and check it out.

git checkout -b [name_of_your_branch]

Add files.

git add -A

Commit the files and write a message.

git commit -m 'Describe your changes.'

Step 4 - Merge Branches

Change back to the master branch and merge.

git checkout master
git merge [name_of_your_branch]

Step 5 - Delete Branches

Remove the branch from Github or a remote host.

git push origin --delete [name_of_your_branch]

Remove the branch on your local computer.

git branch -d [name_of_your_branch]

Extras

Git Tags

Sometimes your sprints feel like milestones and you'd like to identify it with a tag. Here's how to create a tag.