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:
- press
Esc
. - press
:
+w
+q
and then pressEnter
.
- press
- If you want to enter a message for it:
- Press
i
. - Input your message.
- Press
Esc
. - press
:
+w
+q
and then pressEnter
.
- Press
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