-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit command
More file actions
58 lines (46 loc) · 2.37 KB
/
git command
File metadata and controls
58 lines (46 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#首先要登录github创建repository
#命令行托管代码
echo "# TravellMap" >> README.md (optional)
git init
git add README.md
git commit -m "first commit"
#w origin为"remote name",后面要用 TravellMap为"repository name"
git remote add origin https://github.com/huntingboy/TravellMap.git
#传到github相应仓库上面
git push -u origin master
#如果在github的remote上已经有了文件,会出现错误。此时应当先pull一下,即:
git pull origin master
git push origin master
#可选:
#看日志
git log
git log --oneline
#查看修改状态
git status
#回退到***
git reset ***(随机的code)
#直接在android studio托管代码:
1.file->setting->vesion control->git填git命令路径
2.file->setting->vesion control->github填github.com ,用户名,密码
3.vcs->enble****
4.项目右键->git->add
5.项目右键->git->commit repository
5.vcs->import into vc->share project on github
6.填写repository name ,remote name
7.若有改变,vcs->commit change, vcs->git->push
#问题描述 解决方法
remote reposotory created but authorention failed 不选file->setting->vesion control->github->use ssh
fatal: repository 'https://github.com/huntingboy/Notes.git/' not found 先登录github.com创建repository "Notes"
git clone --recursive **** 报错rpc end of file git init ;git config http.postBuffer 524288000 ; git clone ***
FETCH_HEAD: 是一个版本链接,记录在本地的一个文件中,指向着目前已经从远程仓库取下来的分支的末端版本。
commit-id:在每次本地工作完成后,都会做一个git commit 操作来保存当前工作到本地的repo, 此时会产生一个commit-id,这是一个能唯一标识一个版本的序列号。 在使用git push后,这个序列号还会同步到远程仓库。
git fetch origin master:tmp (默认为origin/master)
//在本地新建一个temp分支,并将远程origin仓库的master分支代码下载到本地temp分支
git diff tmp
//来比较本地代码与刚刚从远程下载下来的代码的区别
git merge tmp
//合并temp分支到本地的master分支
git branch -d temp
//如果不想保留temp分支 可以用这步删除
git pull <远程主机名> <远程分支名>:<本地分支名> (可以认为git pull是git fetch和git merge两个步骤的结合)
//取回远程主机某个分支的更新,再与本地的指定分支合并。