simple git instruction

Introduction

local library(workspace)
  a folder/project in your PC
local stage(storespace)
 just a file in folder .git(.git/index)
local repository
 local version list,just a sub-folder in folder .git(.git/object)
remote repsitory
 remote version list,like github

Procedure for creating a git project

  1. create a project file;
  2. use git config to config owner’s user name and e-mail;So,if the code pushed to the remote repository,we can know the bug’s owner and then remide it.
  3. use git initto initial the folder(workspace) as a git project,and then a folder called.gitwill shown;
  4. also,you can use git clone xxxto directly clone the code from remote repository like github;In this way,you shall ignore stape 3,and you shall usegit checkout -b branch-nameto create a branch and jump to it;
  5. edit the code and push the code [ just show the normal shell ]
    a…go to the root dictionary and open the terminial to start git operations;
    b…git add filenamevia the shell,we can add the files we modified to storespace;
    here,you can shellgit status,then the terminial will show that the status is stage,and this respresent the files have been added to storespace; As what you guess,the status isunstagewhile we do nothing;
    c…git commit -m commit-contentvia this shell,we can add the files in the storespace to local repository;
    d…git pushcommt the local branch in local repository to remote repository ;

Common instructions

git add
add the files modified in local library to storespace;
git checkout -b branch-name
create a branch and jump to it;
git branch branch-name
create a branch;
git commit -m
add the files in the storespace to local repository;
git status
scan what to do next step,and project status meaning the files is stage and so on;
git log
scan the commit list of local repository;
git reset
reset the project version you choose,and the version above current version will disappear;
here are some paragrames:
--soft reset to storespace;
--mix reset to workspace with modified content;
--hard reset to workspace with modified content disappeared;
commit id choose a vesion and reset with ‘hard’ paragrame;
git revert
stage ,stash or commit current modified files;and then restart a project based on pervious verison;
git clone remoteproject-link
download project from remote one;
git fetch
update local repository from remote one;
git merge choose-branch
merge choose-branch to current branch
git pull
it is hearing that replace you code with remote code,with master version

note

put the files into folder.gitignore,this means these files will not be tracked;That is:Do not participate in git version management!!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值