当执行 git remote add 时 , 出现
fatal: remote origin already exists
错误
解决方法 , 改为: git remote add origin https://gitlab.com/projectname
For all the girls I loved
此文件不上传也可以, 所以解决方法是在git仓库把它去掉
1 先在git 缓存删除 :
1 |
git rm -r --cached .idea |
2 再把 idea 文件夹加到 gitignore
1 |
adding /.idea to .gitignore |
解决方法来源: http://stackoverflow.com/questions/57091527/what-exactly-is-idea-workspace-xml
To use GitLab CI/CD, all you need is an application codebase hosted in a Git repository, and for your build, test, and deployment scripts to be specified in a file called .gitlab-ci.yml, located in the root path of your repository.
需要写 gitlab-ci.yml 文件 来描述如何自动化 ci , cd
Once you’ve added your .gitlab-ci.yml
configuration file to your repository, GitLab will detect it and run your scripts with the tool called GitLab Runner, which works similarly to your terminal.
写完以后用 gitlab runner 来执行 yml 文件
1 2 3 |
git fetch --all |
1 |
git reset --hard origin/master |
reference from :
https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files
找出2次 commit 的区别
Use git log
to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787
and b410ad4619d296f9d37f0db3d0ff5b9066838b39
). To view the difference between two different commits, use git diff
with the first few characters of the revision specifiers of both commits, like so:
1 2 3 4 5 |
# diff between commits 14b8... and b410... git diff 14b8..b410 # only include diff of specified files git diff 14b8..b410 path/to/file/a path/to/file/b |
If you want to get an overview over all the differences that happened from commit to commit, use git log
or git whatchanged
with the patch option:
1 2 3 4 5 6 7 |
# include patch displays in the commit history git log -p git whatchanged -p # only get history of those commits that touch specified paths git log path/a path/b git whatchanged path/c path/d |
参见 : https://stackoverflow.com/questions/1786027/how-to-view-file-history-in-git
git init
git add .
git commit -m "initial commit"
git remote add origin remote repository URL
git remote -v
git push -f origin master
如果遇到错误 : remote origin already exist ,
1 2 3 4 5 6 |
You already have a remote named origin (the one you cloned from). Just give the new remote a different name and you should be OK: $ git remote add another_origin git@github.com:RiyaKapuria/testing.git and then push to the another_origin by executing git push -u another_origin master |