Step 1 of git

1.initial your git
2.create your repository
3.reopen git blash——>find file
4.add and modify
5.Restore


all things will be executed in git bash

1. initiate it:

$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

Here are some basic techniques

2.create your own repository

$ mkdir learngit
$ cd learngit
$ pwd
/Users/michael/learngit
git init

//here mkdir means create a new file

 $  mkdir + 目录名  <直接创建>
 $ mkdir + -p + 目录名/目录名 <递归创建>

3.Open the file you want

//if you have closed the black box but want to make some change in a particular file

e.g.:if I wan to find *learngit*

$ cd ~
$ pwd
$ cd learngit ~

4.Add and modify——>commit

if you want to commit some your changes

$ git add readme.txt
$ git commit -m "make some change"

here :
add——add a file to to repository
m——comment of this commit

5.Restore

if you want to restore the version you have made before you can

check the log

$ git log   //haven't closed the balckbox before
//or 
$ git log  --pretty=oneline
//or
$ git reflog   //already closed the blackbox

restore

$ git restet --hard HEAD^
//or
$ git reset --hard 49d25(based on log, just pick first few digits)

here :
^—the last version,you can also input ^^,but if you want to restore the file before 100

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值