Git Commands
checking whether the git is installed or not
\>git --version
commands for sending data in git after creating a new repository
\>git init
\>git add .
\>git commit -m "first commit"
\>git branch -M main
\>git remote add origin https://github.com/Minhazcox/my-first-repo.git
\>git push -u origin main
Commands after the 1st time push:
\>git add .
\>git commit -m "image added"
\>git push
Commands for group work/teamwork
\>git branch (it will show the current branch)
\>git branch image-add (branch create)
\>git checkout image-add (switched to image-add branch from main)
Send to git
\>git add .
\>git commit -m "added Ariana"
\>git push (it will show an error)
upstream branch add
\>git push --set-upstream origin image-add
merge branch
\>git branch
\>git checkout main
\>git merge image-add
send data
\>git push
Data pull from the main branch
\>git pull
Create a new branch & get me there
\>git checkout -b add-blog
After working in the add-blog branch we need to send data to git
\>git add .
\>git commit -m "blog added"
\>git push (it will show an fatal error because upstream branch add-blog is not added)
add-blog to upstream
\>git push --set-upstream origin add-blog
merging add-blog branch to main branch
\>git checkout main
\>git merge add-blog
send data to the main branch
\>git push
The resource link for git branch commands