Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git积累 #3

Open
annewanghy opened this issue Jul 28, 2017 · 4 comments
Open

git积累 #3

annewanghy opened this issue Jul 28, 2017 · 4 comments

Comments

@annewanghy
Copy link
Owner

annewanghy commented Jul 28, 2017

关于.gitignore文件

.DS_Store
node_modules/

这样的好处是,可以忽略node_modules等类型的大文件。提高远程仓库的递交速度


递交本地代码到远程仓库

远程仓库的递交方法是

  1. 在github自己的账户下新建一个仓库,new responsity
  2. 克隆到本地
git clone https://github.com/WangHuiying/vCustomers
  1. 本地会有一个vCustomers的文件,将里面的.git文件夹全部拷贝到当前的工作目录下,注意.git文件是一个隐藏文件
  2. 开始递交
git add .
git commit -m "说明"
git push origin master

这样就可以完成远程的递交


github的用处:

  1. 可以把github当成是自己的代码的网盘哦,一般人应该不会把代码保存到百度网盘吧。而且不支持历史记录和修改

  2. 使用Hexo编写文章,把github当成一个免费的服务器, 欢迎参观我的博客

  3. 可以利用github写简历https://resume.github.io/?WangHuiying, 全英文,高大上,有木有

  4. 可以在chrome安装一个gitGist插件, 将看到的代码文章什么的都保存在github上

  5. 最后,如果自己不知道怎么编写.gitignore文件,这边有个在线网站,支持一键生成https://www.gitignore.io/

@annewanghy annewanghy changed the title git和gitignore的使用 git积累 Oct 12, 2017
@annewanghy
Copy link
Owner Author

查看日志, 得到HARD git log
设置为之前的版本git reset -hard HARD号
查看之前的日志,反悔操作,git reflog

@annewanghy
Copy link
Owner Author

git commit --amend 可以对上一次的提交做修改

push -f 如果上一次的提交已经 push 了,那么需要加 f 参数覆盖服务端,不过不建议这么搞

@annewanghy
Copy link
Owner Author

打开github的notification
setting-notification-把email修改成web

@annewanghy
Copy link
Owner Author

Reset single file

git checkout 233b80 -- atoms/button.stories.tsx

Rename branch

If you want to rename a branch while pointed to any branch, do:
git branch -m
If you want to rename the current branch, you can do:
git branch -m
A way to remember this, is -m is for "move" (or mv), which is how you rename files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant