github使用学习

来源:互联网 发布:夏威夷旅行社 知乎 编辑:程序博客网 时间:2024/06/06 18:33

  • 将自己本地代码提交github:

         git init: initialize a git warehouse;

         git add <file> : add a file you wanna be in warehouse;      git add * : add all files into git warehouse;

         git commit -m "describe your change here" : you could commit what you've done; 

         git status : you could check the state of temporary workspace;

         git push : push files in warehouse to your github

  • 关联远程仓库
         git remote add <warehouse name> <url> :   own named origin,  remote git named upstream
         git remote -v : 使用这个命令查看当前远程库;
         git push -u <远程仓库名> <分支名>  推送本地<分支名>

  • 查看分支:git branch, 可增加参数 -a 和 -v
    创建分支:git branch <新的分支名>
    切换分支:git checkout <已有分支名>
    创建+切换分支(本地):git checkout -b <新的分支名>
    创建+切换分支(从远程仓库) git checkout -b <新的本地分支名> <远程仓库名>/<远程分支名>
    合并某分支到当前分支:git merge <已有分支名>
    删除分支:git branch -d <已有分支名>
    强行删除分支(在未merge之前):git branch -D <已有分支名>

0 0
原创粉丝点击