block by pnavarrc 0c6fc4b3cd2bbec0a8c4

Git Essential Commands

Basic Git Commands

List Local Branches

git branch


git commit -am 'Commit comment'

Create a New Branch

# Go to the base branch first
git checkout -b new_branch_name

Switch to an Existing Branch

git checkout branch_name

Push a Local Branch to a Remote (GitHub)

git push -u origin branch_name

Pull Changes from a Remove (GitHub)

# Switch to a branch to merge the remote to the local
git pull


# Go to the target branch
git merge --no-ff current_branch target_branch