美文网首页
Git 使用小记

Git 使用小记

作者: 坚果牛奶 | 来源:发表于2019-04-04 12:12 被阅读0次

Ignore idea folders
git rm -r --cached .idea

Merge a branch into master branch in GitHub
git checkout master
git pull origin master
git merge $YourBranchName$
git push origin master

Sometimes when you try to pull or merge code, the git bash may occur the screen to ask you to enter a commit message. The message may say "Please enter a commit message to explain why this merge is necessary."
solution:

  • If you do not want to enter any message for this pull or merge:
    1. pressEsc.
    2. press:+w+q and then press Enter.
  • If you want to enter a message for it:
    1. Press i.
    2. Input your message.
    3. PressEsc.
    4. press:+w+q and then press Enter.

If you have pushed your code before you ignore some folders when you try to pull, you may get the message like this: "The following untracked working tree files would be overwritten by checkout"
solution:
git fetch --all
git reset --hard origin/{branch_name}

If you changed your local code and have not committed it, but you want to pull the update from the remote repository, you may get the error message "Your local changes to the following files would be overwritten by merge"
solution:
git stash
git pull origin master
git stash pop

To add .gitignore file(windows下添加.gitignore文件):
touch .gitignore
Ignore all .pyc files in git repository(忽略所有.pyc文件):
add a line to the .gitignore file
*.pyc

相关文章

  • Git 设置.gitignore 不生效的解决办法

    git学习使用小记 @(Alu)打开git命令行:输入: 清除git的本地版本库缓存再输入: 将你的 .gitig...

  • Git 使用小记

    常用的checkout 或者clonecheckoutcd 你的目录git initgit remote add ...

  • git使用小记

    git diff 命令 1、每修改一次文件,要想比较暂存区和上次提交的变化,都要执行 add命令。2、git st...

  • Git 使用小记

    每个项目都有一个 Git 目录(译注:如果 git clone 出来的话,就是其中 .git 的目录;如果 git...

  • git使用小记

    最近刚入职了一家新公司,代码管理也从熟悉的SVN到不太熟练的git。 以下记录了这段时间使用的比较多的命令。 Gi...

  • Git使用小记

    1、常用命令 初始化 添加一个文件到 暂存区。git add . 添加当前目里下所有文件到暂存区 把暂存区域的文件...

  • Git 使用小记

    Ignore idea foldersgit rm -r --cached .idea Merge a branc...

  • git 代码版本管理工具add、commit、pull、push

    接触git版本管理工具有一段时间了,工作中使用到git,特此小记git代码版本管理工具add、commit、pul...

  • git使用小记---比较

    变化比较 git diff比较当前未add文件与上一次add文件的区别(workingtree与index) 比较...

  • Git 教程(命令行)

    Git命令小记 分支 1、创建本地分支 local_branch $ git branch

网友评论

      本文标题:Git 使用小记

      本文链接:https://www.haomeiwen.com/subject/mndfiqtx.html