san*_*han 4 git terminal command-line
我在Git上传文件夹中添加了一个文件.我可以在未分级的情况下看到SourceTree中的文件夹.如何使用终端命令将文件推送到在线存储?
我想出来我需要先cd到本地存储库,我用这个做了:
cd /Users/mainuser/Desktop/Projects
git add -A .
Run Code Online (Sandbox Code Playgroud)
检查状态,git status
并输出:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: ios_projects/2016/Untitled copy 2.rtf // this is the file I want to upload
Run Code Online (Sandbox Code Playgroud)
现在怎么办?我如何提交并将其推送到网上?
Sha*_*ani 13
接下来的事情就是提交使用然后推送到你想要推送的分支
git commit -m 'Some message about the change'
git push origin 'branch-name'
Run Code Online (Sandbox Code Playgroud)
san*_*han 10
事实证明就是这么简单:
cd /Users/mainuser/Desktop/YourFolder
git add -A .
git commit -m 'commit message from terminal'
git push
Run Code Online (Sandbox Code Playgroud)
编辑:如果你只使用git commit
without -m
,你会进入一些编辑器来输入提交消息,我不知道如何退出。
尝试以下命令:
$ git status
$ git add <file_name>
$ git commit -m "<msg>"
$ git push origin <branch_name>
Run Code Online (Sandbox Code Playgroud)