0% found this document useful (0 votes)
12 views

Git Commands

Uploaded by

rohithatimsi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Git Commands

Uploaded by

rohithatimsi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1) after installation of git please create one empty folder (yournam_learnbay) in

any drive
2) go inside the empty folder --> right click --> git bash --> plese click git bash
3) you will get black open window

4 ) git config --global user.name "<your name>"

5) git config --global user.email "<your email>"

6) git init

7) create one file with name "login" in the empty folder -->

8) git add login.txt

9) git commit -m "adding login.txt"

10) git status

11) git remote add origin "https://github.com/viren26git/learnbay"

12) git pull origin master

13) git push -u -f origin master

removing the file from the local repos


14) git rm login.txt

15) git commit -m "deleted file login.txt"

16) git push origin master

=====================================================

to create a new branch:

1) git branch copybranch


2) git checkout copybranch ( top point your working directory to copybranch)

to merge the single branch together:

if you are present on the your copybranch


1) git checkout master
2) git merge copybranch
3) ifyou want to sync the changes between the working directory (here, master) to
--> remote repos
git push origin master

=====================================================

git fetch is used to sync the changes between the remote repos and local repos only
and then you have to do reabsing to sync the changes between the local repos and
working directory

git pull is direct syncing the changes between the remote repos and working
direcotory via local repos

Sytax:
delete/modify some file from the remote repos
1) git fetch = soft delte
2) git rebase origin/master

=====================================

git fetch is done if you want to modify the file recrusively so keep your file on
local repos only for pushing directly
by mistake some body deleetd the file from your remote repos so dont pull just ue
fetch to keep your changes limited till loca repos only

You might also like