1. how to use github.iu?
github iu is an enterprise type of github.
You can add an account of github and an account of github,iu to desktop github.
By using desktop version, you can use two accounts both. But for terminal, you'd better specify an account. I choose to use github.iu.edu account.
You need to generate SSH keys for git to link to your local computer.
http://1ke.co/course/194
https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E8%AE%B0%E5%BD%95%E6%AF%8F%E6%AC%A1%E6%9B%B4%E6%96%B0%E5%88%B0%E4%BB%93%E5%BA%93
2. how to simultaneously use two accounts in github desktop?
I think we can, but using one account I think is enough. We can use desktop version github to control.
3. how to realize the version control by using the git command?
upload local change to repository:
git reset --mixed origin/master
git add .
git commit -m "This is a new commit for what I originally planned to be amended"
git push origin master
there is another way which can combine add and commit together:
git commit -a -m 'added new benchmarks'
das…or create a new repository on the command line
echo "# aaa" >> README.md git init
git add . git add README.md git commit -m "first commit" git remote add origin https://github.iu.edu/gao27/aaa.git git push -u origin master
…or push an existing repository from the command line
git remote add origin https://github.iu.edu/gao27/aaa.git git push -u origin master
#remove .git
rm -rf .git
help to check each commit
git log
shift+q exit log history
how to upload the change to remote github
git add .
git commit -m "first commit"
git push -u origin master
how to pull new changes from github
check to convert to previous version
// open a new branch
ZhengGao:src gaozheng$ git reset --hard HEAD
HEAD is now at 3b89d52 added new benchmarks
ZhengGao:src gaozheng$ git reset 3b89d52
ZhengGao:src gaozheng$ git reset --soft HEAD@{1}
ZhengGao:src gaozheng$
ZhengGao:src gaozheng$ git commit -m "Revert to 56e05fced"
[master e9681ab] Revert to 56e05fced
3 files changed, 3 insertions(+)
create mode 100644 test1.txt
create mode 100644 test2.txt
create mode 100644 test3.txt
ZhengGao:src gaozheng$ git reset --hard
HEAD is now at e9681ab Revert to 56e05fced
1.init one folder as master
git init
git add . git add README.md git commit -m "first commit" git remote add origin https://github.iu.edu/gao27/aaa.git git push -u origin master
2. copy 1 folder to another computer
3. git pull first and then update
git pull
and then git add .
git commit -m "first commit"
git push -u origin master
如何正确使用gitignore.
https://www.jianshu.com/p/a3e6b5b2ab59
如果gitignore 声明晚了,可以用参考 https://www.jianshu.com/p/e5b13480479b 比如用
git rm -r --cached .
如果想取消之前git add .的操作的话,可以看下git status. 然后
rm -f ./.git/index.lock
No comments:
Post a Comment