美文网首页
Git版本控制(Version Control)

Git版本控制(Version Control)

作者: 蕉下客_fc5b | 来源:发表于2017-11-10 14:38 被阅读0次

download link: https://git-scm.com/downloads
tutorial link: https://www.atlassian.com/git/tutorials

Initializing a new repository: git init

git init : create a new .git subdirectory in your current working directory. This will create a master branch.

Cloning an existing repository: git clone

create a copy or clone of remote repositories.

Saving changes to the repository: git add and git commit

The git add command adds a change to the staging area. However, git add doesn't actually recorded until you run git commit.

  • git status : view the current branch and state of working directory
  • git add <file> stage all changes in <file>
  • git add <directory>
  • git add . stage all files
  • git add -p : y to stage the chunk, n to ignore the chunk, s to split it into small chunks, e to manually edit the chunk, and q to exit.

Git stash

Git stash temporarily saves your changes you've made to your working copy so you can work on something else.
Re-applying your stashed changes : git stash pop
Stashing untracked or ignored files*
By default, running git stash will stash

  • staged chagnes
  • changes tracked by git (unstaged changes)

But it will not stash:

  • new files in your working copy that have not yet been staged
  • files that have been ignored

.gitignore

Git sees every file in your working copy as one of three things:

  • tracked - a file which has been previously staged or committed
  • untracked - a file which has not been staged or committed; or
  • ignored - a file which git has been explicitly told to ignore

Syncing

git remote / git fetch / git pull / git push

  • git remote : create, view and delete
    git config :

cheat sheet
git status : check current branch and status
git add . : stage all changes
git commit : commit changes
git commit --amend : make changes for last commit and change this commit
git checkout branchName : switch to a branch
git checkout -b newBranchName: create a new branch
git log : check log
git lg : show branches table

git push origin branchName : push your branch to remote
git push origin branchName --force : force update your remote branch

git remote -v : checkout your upstream
git branch -a : show all branches

To be continued...

相关文章

  • git 版本管理

    Git版本控制管理@[TOC] git Git is a distributed version control ...

  • Git入门

    Git入门 标签: 版本控制工具 Git介绍 Git is a version control system. G...

  • Git内部培训课件

    Git内部培训课件 Git简介 什么是版本控制 版本控制系统(Version Control System,简称V...

  • git、github和gitlab的区别

    git git,就是一个版本控制系统(Version Control System,VCS)。版本控制是一种记录一...

  • Git 系列教程(一)Git 简介

    Git 系列教程(一)Git 简介 1.关于版本控制 Version control is a system th...

  • Git版本控制(Version Control)

    download link: https://git-scm.com/downloadstutorial link...

  • 版本控制

    Git Git是一个分布式版本控制系统(Distributed Version Control System - ...

  • Git使用2017.4.28-5.2-5.3

    git工具的优势DVCS,distribution version control system,分布式版本控制,...

  • Git

    Git命令速查表 Git介绍 版本控制系统 VCS(Version Control System) Git是一个免...

  • Git入门介绍

    其实Git就是一个开源的版本控制系统,Version Control System, 简称VCS。版本控制系统简单...

网友评论

      本文标题:Git版本控制(Version Control)

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