Git basic
2015-07-04 14:31
411 查看
1. solve conflict
senario:
Adam checked out master branch,
then Bob checked out master branch,
then Adam modify a file, commit and push,
then Bob modify the same file,
then Bob need to commit, then pull, then manually resolve the conflit, then commit again, then push.
2. ignore a tracking file, remove from remote
http://stackoverflow.com/questions/9237345/how-do-i-ignore-pycharm-configuration-files-in-a-git-repository
for single file
for folder
3. save password and username
http://stackoverflow.com/questions/11403407/git-asks-for-username-everytime-i-push
senario:
Adam checked out master branch,
then Bob checked out master branch,
then Adam modify a file, commit and push,
then Bob modify the same file,
then Bob need to commit, then pull, then manually resolve the conflit, then commit again, then push.
2. ignore a tracking file, remove from remote
http://stackoverflow.com/questions/9237345/how-do-i-ignore-pycharm-configuration-files-in-a-git-repository
for single file
git rm --cached [filename]
for folder
git rm --cached -r [folder]
3. save password and username
http://stackoverflow.com/questions/11403407/git-asks-for-username-everytime-i-push
git config credential.helper store git push http://example.com/repo.git[/code]
4. compare file with last commitgit diff HEAD [filename]
5. revert file to last commit
http://stackoverflow.com/questions/692246/undo-working-copy-modifications-of-one-file-in-gitgit checkout -- [filename]
6. only add tracking filegit add -u
7. download projectgit remote add origin https://github.com/xxx.git git pull origin master
8. change origin (in case like repo name changed)
check remotegit remote -v
change remote origingit remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git[/code]
相关文章推荐
- GO语言练习:第一个Go语言工程--排序
- a标签的title属性及如何隐藏聚焦
- 【WebView加载本地资源图片 字体等】一些不常用的用法集合
- Leetcode 94 Binary Tree Inorder Traversal
- MySQL5.6中设置relay_log_info_repository 为TABLE
- Xcode调试
- Leetcode 136 Single Number
- 《猜猜看》游戏设计
- 外贸网站使用国外空间好吗?
- 【bzoi2006】【狼抓兔子】【最小割】
- JsonArray和JsonObject的使用
- MFC六大机制之五:动态创建机制
- Watch OS2.0开发概述
- 使用C++11thread实现的一道面试题(一)
- Leetcode 49 Anagrams
- 【MatLab】将矩阵写入到文件
- [数字dp] hdu 3271 SNIBB
- mysql批量备份 多表
- Leetcode 204 Count Primes
- 关于Runtime.getRuntime().exec 进程会一直被挂起,一直在等待的原因。