0% found this document useful (0 votes)
17 views2 pages

Github

The document outlines the steps to push code to a Git repository and manage branches. The key steps are: 1. Initialize a local repository with `git init`. 2. Add files with `git add` and commit changes with `git commit`. 3. Connect the local repository to a remote repository on GitHub with `git remote add` and push commits with `git push`. 4. Manage branches locally and on remote with commands like `git branch`, `git checkout` and `git push --set-upstream` when creating a new branch.

Uploaded by

sprova321
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Github

The document outlines the steps to push code to a Git repository and manage branches. The key steps are: 1. Initialize a local repository with `git init`. 2. Add files with `git add` and commit changes with `git commit`. 3. Connect the local repository to a remote repository on GitHub with `git remote add` and push commits with `git push`. 4. Manage branches locally and on remote with commands like `git branch`, `git checkout` and `git push --set-upstream` when creating a new branch.

Uploaded by

sprova321
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

HOW to PUSH code to git repository:(process)

1. git init
2. git status
3. git add [file name] –if we want to add single file
4. git add . ---- when we want to add all file
5. git commit -m ‘[commit name]’
6. git branch -M main (It is default branch so no need to use this this command.I will automaticly
add you code to mastar branch.You can skip this command)
7. git remote add origin [your repository link]
8. git push -u origin master ----instead master you can use you your required branch

If we changes any file and add to this repository the follow this(process):

1. git add .
2. git status
3. git commit -m ‘[other commit name]’
4. git push

To live you react site follow this(process):

 yarn add -D gh-pages

https://github.com/Moin3/URL-Shortener.git

Present barach check:

 git branch
 git status

Create new branch:

 git branch [new branch name]

check all exist branch:

 git branch –list

Switch the branch

 git checkout [desired exist branch name]

create new baranch and switch to this branch to in one line command

 git checkout -b [new branch name]

To push this code on github follow this step:


 git init {not necessary in this case}

check the code starus:

 git status

add code to local repository:

 git add .

git commit and add comment to this repository

 git commit -m ‘[message]’

To push the code to the remote repository:

 git push (general case)


 git push --set-upstream origin [new branch name] (when we push our code to new branch)

moinIslam

You might also like