To add the folder in git use cmd :-
1)git --version
2)git config --global user.name '----'
3)git config --global user.email '----'
To start git in terminal use cmd:-
- git init
- git status --> to check the status of all the files
- git add filename (or git add . --> this cmd will track all the uncommited files and add them all in just one click )
- git commit -m "write your commit message"
To change the name master with main use cmd :-
- git branch -M main
To add the origin to the remote file in git use cmd :-
-
git remote add origin (paste the repo link here )
-
git push -u origin main (all your files are added to git repo)
To make branch and merge use cmds :-
-
git branch branch-name --> this will create a new branch with diffrenet name
-
git checkout branch-name --> to go to the newly created brnach
-
git checkout -b newBranch-name ---> by this u can make new branch and also moveto that branch .(Shortcut)
-
git branch new-branch-name souce-branch --> this will ensure that the new branch is created inside the right source branch
steps to merge the branch with the main branch
- git checkout main
- git pull origin main
- git merge branch_name
- git push origin main
To connect local and remote files use cmd:-
- git push -u origin main ---> this will not only push the first update but also make a 2 way connection between them . No need to run this commend after 1 time ...just use "git push " .