git two

本文通过实战演示了如何使用Git进行代码版本控制,包括状态查询、暂存更改、撤销更改、拉取远程更新及还原暂存区等操作。通过具体场景展示了Git在日常开发中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)


        modified:   app/src/main/java/com/yuanxin/clan/core/MainActivity.java


no changes added to commit (use "git add" and/or "git commit -a")


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git stash
Saved working directory and index state WIP on master: 573fd6d first commit


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git pull
Already up-to-date.


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git stash pop
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)


        modified:   app/src/main/java/com/yuanxin/clan/core/MainActivity.java


no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (00bbb3d3e789d14bb105f5ece328317bdd322c63)


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git add .


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)


        modified:   app/src/main/java/com/yuanxin/clan/core/MainActivity.java




Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ git commit
Aborting commit due to empty commit message.


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/YuanxinClan_Android (master)
$ cd ../prac/


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac
$ git clone git@git.oschina.net:yx_tribe/GitPrac.git
Cloning into 'GitPrac'...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (6/6), done.


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac
$ cd GitPrac/


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac/GitPrac (master)
$ ls
README.md  test.txt


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac/GitPrac (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac/GitPrac (master)
$ git pull
Already up-to-date.


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac/GitPrac (master)
$ ^C


Administrator@PC-20170531NDJV MINGW64 /e/GithubDemo/prac/GitPrac (master)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值