git 详细教程,从头开始,看简单英文比中文好懂

本文是一份Git教程,涵盖了从设置用户名和邮箱开始的基础知识,包括创建本地仓库、克隆远程仓库、新增文件并推送、获取远程仓库更新。对于进阶用户,介绍了分支管理、打标签、修改远程分支、重命名分支以及对比差异等高级操作。
摘要由CSDN通过智能技术生成

Get started

Setting up your username and email


  • GIT records your name and email address with every commit you make, so the first step is to tell GIT what these are so you can get credit for your work
GIT command
$ git config --global user.name 'Your Bitbucket username'
$ git config --global user.email you@somedomain.com
Sample Usage
$ git config --global user.name 'ravidte'
$ git config --global user.email 'ravid.te@owmessaging.com'


Beginner

 

PLEASE NOTE, Section I and II below, are not to be followed in order, they are 2 separate Actions (one to create a new local git repo to push to remote GIT, and the other to obtain "clone" an existing repo from GIT).

Please use one or the other for your purposes.

 

      NOTE:  Using Project DEVOPS for Sample Usage Examples


I. Version controlling your existing project

  • "git init" can be used to create a new GIT repository by converting an existing unversioned project to a GIT repository or initializing a new empty repository.
GIT command
$ cd ~ /workspace/project
$ git init
$ git remote add origin git@bitbucket.org:openwave/{reponame}.git
$ git pull origin master
$ git add <files>
$ git commit -m "JIRAKEY comment"
$ git push origin master
Sample Usage
$ cd ~/Work/AUTOMATION/
$ git init
Initialized empty Git repository in /Users/rte/Work/AUTOMATION/.git/
$ git remote add origin git @bitbucket .org:ravidte/testmigration.git
$ git pull origin master
remote: Counting objects: 5 , done.
remote: Compressing objects: 100 % ( 2 / 2 ), done.
remote: Total 5 (delta 0 ), reused 0 (delta 0 )
Unpacking objects: 100 % ( 5 / 5 ), done.
From bitbucket.org:ravidte/testmigration
  * branch            master     -> FETCH_HEAD
$ git add .
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#    new file:   testfile1.java
#    new file:   testfile2.java
#    new file:   testfile3.java
#
$ git commit -m "DEVOPS-243 adding new project to test migration"
[master 64a0261] DEVOPS- 243 adding new project to test migration
  3 files changed, 3 insertions(+)
  create mode 100644 testfile1.java
  create mode 100644 testfile2.java
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值