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常用命令 #18

Open
raclen opened this issue Sep 15, 2019 · 0 comments
Open

git常用命令 #18

raclen opened this issue Sep 15, 2019 · 0 comments
Labels
博客搬迁 以前博客的文章迁移过来

Comments

@raclen
Copy link
Owner

raclen commented Sep 15, 2019

clone一个仓库
git clone https://github.com/XXXXXX/jsCode.git
修改的东西添加到仓库
git add . 提交所有文件
git commit -m ‘修改标记’
git pull 更新仓库
git push 提交更新
git branch 查看本地所有分支
git status 查看当前状态
git branch -a 查看所有的分支
git checkout -b dev 建立一个新的本地分支dev
git merge origin/dev 将分支dev与当前分支进行合并
git checkout dev 切换到本地dev分支
git rm 文件名(包括路径) 从git中删除指定文件
git rm [文件夹]/* 可以删除文件夹所有文件,然后文件夹不见了
git commit -m “remove” 移除文件(从Git中删除)
git reset --hard HEAD(回退)
删除步骤
1、本地删除
2、git add .
3、git commit -am ‘remove’ 一次性提交
4、git push
回退到某个版本
commit d656b7c8c3f681b779837005c1b882f0ee40f213
git reset --hard d656b7
当提示没有需要提交的的代码的时候
git commit --amend
:x 回车
git push origin HEAD:refs/for/release --no-thin
git push
//设置代理
git config --global http.proxy 'socks5://127.0.0.1:10087'
git config --global https.proxy 'socks5://127.0.0.1:10087'
// 打包自动提交

    "pkg" :"npm run build",
    "prepkg": "git pull",
    "postpkg": "git add -A && git commit -m auto-pkg -n && git push"

// 强推到远程
git reset --hard commit_id 退到/进到 指定commit的sha码
git push origin HEAD --force
在 Git 中 Checkout 历史版本

@raclen raclen added the 博客搬迁 以前博客的文章迁移过来 label Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
博客搬迁 以前博客的文章迁移过来
Projects
None yet
Development

No branches or pull requests

1 participant