Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Last active June 16, 2024 06:56
Show Gist options
  • Save nanusdad/7e516743e5e709073f7e to your computer and use it in GitHub Desktop.
Save nanusdad/7e516743e5e709073f7e to your computer and use it in GitHub Desktop.
Git - create new local branch push to GitHub

git checkout -b [name_of_your_new_branch]

  • Push the branch on github :

git push origin [name_of_your_new_branch]

  • When you want to commit something in your branch, be sure to be in your branch.

  • You can see all branches created by using :

git branch

Which will show something like :

* approval_messages
  master
  master_clean

Add a new remote for your branch :

git remote add [name_of_your_remote]

Push changes from your commit into your branch :

git push origin [name_of_your_remote]

Update your branch when the original branch from official repository has been updated :

git fetch [name_of_your_remote]

Then you need to apply to merge changes, if your branch is derivated from develop you need to do :

git merge [name_of_your_remote]/develop

Delete a branch on your local filesystem :

git branch -d [name_of_your_new_branch]

To force the deletion of local branch on your filesystem :

git branch -D [name_of_your_new_branch]

Delete the branch on github :

git push origin :[name_of_your_new_branch]

@andreemic
Copy link

I love you for that.

@manojkumarkhedkar
Copy link

thanks

@VladPetriv
Copy link

Thanks)

@jaloliddiNomozov03
Copy link

  • **_[sfdf
  • #@

](url)_**

@jaloliddiNomozov03
Copy link

IMG_20191203_163552_763

@mhossny
Copy link

mhossny commented May 12, 2021

Sweet.

@saigopika
Copy link

Thank you!!

@benjaminyakobi
Copy link

Magnificent, God bless you!

@rjbj25
Copy link

rjbj25 commented Nov 4, 2021

Thank you <3

@RayanMohamed
Copy link

Thank you :)

@NVG-064
Copy link

NVG-064 commented May 18, 2023

Thanks. Easy to understand in a short way

@antsf
Copy link

antsf commented Feb 7, 2024

Very helpful. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment