Skip to content

Common Git command workflow

YASHSVI GIRDHAR edited this page Apr 4, 2023 · 3 revisions

Git Workflow

# update local repo
git pull
# display the state of the working directory and the staging area
git status
# create/checkout new branch
git checkout -b <new branch name>
git status
# adds a change in the working directory to the staging area
git add .
git status
# captures a snapshot of the project's currently staged changes
git commit -m "comments go here"
git status
# push branch to origin
git push origin <new branch name>
git status

AFTER MERGE

# switch to the main branch and update local repo
git checkout main
git pull
git branch --delete <branchname>

To update your working branch with main

git checkout main
git pull

git checkout <branch-name>
git merge main
git commit #if it does NOT automatically fast forward