美文网首页
Git 快速入门

Git 快速入门

作者: TXN | 来源:发表于2017-11-17 13:05 被阅读9次

Configure Git for the first time

git config --global user.name "txn"
git config --global user.email "txn@qq.com"

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.last 'log -1 HEAD'

Working with your repository

git clone http://txn@10.15.3.9:7990/txn.git

My code is ready to be pushed

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin http://txn@10.15.3.9:7990/txn.git
git push -u origin master

My code is already tracked by Git

cd existing-project
git remote set-url origin http://txn@10.15.3.9:7990/txn.git
git push -u origin master

Common Commands

git add .
git commit -m "Update"
git commit -a -m "Update"
git pull origin master
git push origin master
git pull(git fetch,git merge)
git branch -b(git branch,git checkout)
git log --oneline

Branch Workflow

git checkout -b future-plans
git branch future-plans
git checkout future-plans 

git checkout master 
git merge future-plans
git branch -d future-plans

git push origin future-plans
git push origin :future-plans

Atlassian Git Tutorial

https://www.atlassian.com/git

Learn Git with Bitbucket Cloud

git clone https://emmap1@bitbucket.org/emmap1/bitbucketstationlocations.git
git status
git add locations.txt
git commit -m 'Initial commit'
git push origin master
git pull --all

git branch -b future-plans
git branch future-plans
git checkout future-plans
git checkout master
git merge future-plans

Learn about code review in Bitbucket Cloud

Learn Branching with Bitbucket Cloud

git branch test-1
git checkout test-1
git push origin test-1
git branch -d test-1


git fetch && git checkout test-2
git merge master test-2

Comparing Workflows

Centralized Workflow
Git Feature Branch Workflow

git checkout master
git fetch origin 
git reset --hard origin/master

git checkout -b new-feature
git status
git add <some-file>
git commit

git push -u origin new-feature
git push


git checkout master
git pull
git pull origin marys-feature
git push

Gitflow Workflow

git checkout -b develop
git checkout -b release/0.1.0
git checkout develop
git checkout -b feature_branch
# a bunch of work is done on the features
git checkout release/0.1.0
git merge feature_branch
# assuming that the release branch is done with that feature
git checkout develop
git merge release/0.1.0
git checkout master
git merge release/0.1.0
git branch -D release/0.1.0

git checkout master
git checkout -b hotfix_branch
# work is done commits are added to the hotfix_branch
git checkout develop
git merge hotfix_branch
git checkout master
git merge hotfix_branch

Forking Workflow

相关参考

https://git-scm.com/docs/
https://www.atlassian.com/git
http://git.oschina.net/progit/

相关文章

  • git技术,GitHub、GitLab

    git学习 Git教程(小白快速入门版) Git教程(简化版) git详细学习 Gitlab的管理使用手册git初...

  • Git(分布式版本控制系统)

    1 Git是什么 - 认识 -为何需要Git - Git和GitHub有何区别 2 快速入门 git在相应的操作系...

  • git快速入门

    1.Androidstudio中使用git (1)基本配置 a.创建git版本控制:vsc->import int...

  • Git快速入门

    git是什么? Git是一个开源的分布式版本控制系统,可以有效、高速的处理从很小到非常大的项目版本管理。Git 是...

  • git 快速入门

    这篇文章写的是我对git基本概念的理解,不涉及具体的命令行操作。希望能帮助到那些想要理解git工作原理的人。 具体...

  • git快速入门

    一.项目的创建 1.新建好项目目录 2.初始化git,命令git init 3.将代码添加到暂缓区,命令 git ...

  • Git快速入门

    0. Git简介 git是一个分布式版本控制软件,最初由林纳斯·托瓦兹(Linus Torvalds)创作,于20...

  • GIT快速入门

    大纲: 一、前言 二、概述 三、在Windows上安装Git 四、创建本地仓库 五、本地仓库管理详解 六、总结 注...

  • GIT快速入门

    基本配置 下载软件 git-scm Git配置用户名与邮箱 配置公钥 多账户配置(可跳过) 传送门: Window...

  • Git 快速入门

    Configure Git for the first time Working with your reposi...

网友评论

      本文标题:Git 快速入门

      本文链接:https://www.haomeiwen.com/subject/ydfjvxtx.html