Difference between revisions of "Basic Git Command"

From Gejoreuy
Jump to navigation Jump to search
(Created page with "https://www.earthdatascience.org/workshops/intro-version-control-git/basic-git-commands/")
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
https://www.earthdatascience.org/workshops/intro-version-control-git/basic-git-commands/
 
https://www.earthdatascience.org/workshops/intro-version-control-git/basic-git-commands/
 +
 +
 +
'''Create New Branch from Master or Other Branch'''
 +
$ git pull                                    # pull from original branch
 +
$ git checkout -b [new_branch_name]          # creating new branch in our local fs
 +
$ git push origin [new_branch_name]          # push our new branch to Github or Gitlab
 +
$ git config core.autocrlf false              # stop replacement warning message
 +
 +
'''Delete Branch in Our Local Filesystem'''
 +
 +
$ git branch -d [name_of_branch]
 +
 +
or
 +
 +
$ git branch -D [name_of_branch]              # force deletion
 +
 +
'''Delete Branch in Github or Gitlab'''
 +
 +
$ git push origin :[name_of_branch]

Revision as of 13:59, 9 July 2020

https://www.earthdatascience.org/workshops/intro-version-control-git/basic-git-commands/


Create New Branch from Master or Other Branch

$ git pull                                    # pull from original branch
$ git checkout -b [new_branch_name]           # creating new branch in our local fs
$ git push origin [new_branch_name]           # push our new branch to Github or Gitlab
$ git config core.autocrlf false              # stop replacement warning message

Delete Branch in Our Local Filesystem

$ git branch -d [name_of_branch]

or

$ git branch -D [name_of_branch]              # force deletion

Delete Branch in Github or Gitlab

$ git push origin :[name_of_branch]