Git Flashcards
What does Git Bash do?
Helps in organizing and managing versions of our product
Initialize Git
git init
Add to local git
Staging area -> git add (filename or .)
Commit -> git commit -m “message here”
Update changes
to local git
git add .
git commit -m “message here”
Branch in local git
git branch (branch-name)
Switch to branch
git checkout (branch-name)
Local merge changes from Local
branch
switch to the branch or master you wanna merge into and –
git merge (branch-name)
(this will open vim to put in merge comment and you can quit it using ‘:q!’)
Push local git to Remote git
FIRST POINT THE LOCAL REPOSITORY TO THE REMOTE URL –
git remote add origin (remote_url)
PUSH THE LOCAL FILES TO REMOTE REPOS –
git push origin master
Update Remote repos
from Local
git push (REMOTENAME) (BRANCHNAME)
Example - git push origin main
Merging changes into your local branch
git merge (remote-name/branch-name)
Pulling changes from a remote repository
git pull (remote-name) (branch-name)