git基本命令
git config --global user.name 用户名 设置用户签名
git config --global user.email 邮箱 设置用户邮箱
git init 初始化本地库
git status 查看本地库状态
git add 文件名 添加到暂存区
git commit -m "
日志信息
" 文件名 提交到本地库
git reflog 查看历史记录
git reset --hard 版本号 版本穿梭
git branch 分支名 创建分支
git branch -v 查看分支
git checkout 分支名 切换分支
git merge 分支名 把指定的分支合并到当前分支上
git remote -v 查看当前所有远程地址别名
git remote add 别名 远程地址 起别名
git push 别名 分支 推送本地分支上的内容到远程仓库
git clone 远程地址 将远程仓库的内容克隆到本地
git pull 远程库地址别名 远程分支名
将远程仓库对于分支最新内容拉下来后与
当前本地分支直接合并
集成IDea
1.创建忽略规则文件
xxxx.ignore
(前缀名随便起,建议是
git.ignore
)
这个文件的存放位置原则上在哪里都可以,为了便于让
~/.gitconfig
文件引用,建议也放在用
户家目录下,git.ignore
文件模版内容如下:
# Compiled class file*.class# Log file*.log# BlueJ files*.ctxt# Mobile Tools for Java (J2ME).mtj.tmp/# Package Files #*.jar*.war*.nar*.ear*.zip*.tar.gz*.rar# virtual machine crash logs, seehttp://www.java.com/en/download/help/error_hotspot.xmlhs_err_pid*.classpath.project.settingstarget.idea*.iml
2.
在
.gitconfig
文件中引用忽略配置文件(此文件在
Windows
的家目录中)
[user]name = Layneemail = Layne@atguigu.com[core]excludesfile = C:/Users/asus/git.ignore注意:这里要使用“正斜线( / )”,不要使用“反斜线( \ )”