Tuesday, August 13, 2019

Create a new branch with git from command line

Working with git from a terminal is more efficient, so here are some basic commands:

1. Get up to date:
git pull

2. Create a new branch locally from dev branch (this is just an example, can be any other branch, like master, etc.)
git checkout -b AI-Task123 dev

(where AI are my initials so we know who owns the branch and Task123 is the task number for tracking)

3. Push branch on github:
git push origin AI-Task123

4. Commit your code:
git commit -m "Your message"

5. Push the code:
git push

Other useful commands:

6. Delete a branch
git branch -D AI-Task123

Reference: https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches
https://stackoverflow.com/questions/4470523/create-a-branch-in-git-from-another-branch

No comments:

Post a Comment