通过命令行使用git
我在通过命令行使用git时遇到问题。 我正在尝试推送定期更改的文件,这些文件可能会在任何时候从本地驱动器中删除,并且也需要推送 我知道如何通过sourcetree做这类事情,但不确定在命令行上做什么 我目前有:通过命令行使用git,git,github,cmd,Git,Github,Cmd,我在通过命令行使用git时遇到问题。 我正在尝试推送定期更改的文件,这些文件可能会在任何时候从本地驱动器中删除,并且也需要推送 我知道如何通过sourcetree做这类事情,但不确定在命令行上做什么 我目前有: git init git add --all git commit -m "Test" git remote add *"Repository"* git push econnectConfig master 我只想基本上我不关心大师那里有什么,但我不想使用武力,因为我想看到所做的改变
git init
git add --all
git commit -m "Test"
git remote add *"Repository"*
git push econnectConfig master
我只想基本上我不关心大师那里有什么,但我不想使用武力,因为我想看到所做的改变的历史。我如何做到这一点,因为我目前发现了关于所有内容都不同步的错误
干杯您正在这样做:
git init -> initialize a git repository in the current directory
git add --all -> add all files
git commit -m "Test" -> commit which files? git commit -a -m 'test' will add all
git remote add *"Repository"* -> tell you local repository where to connect to
git push econnectConfig master -> push your changes to the remote master branch
但是您的本地存储库不知道远程内容。所以它不能推它
这里有一种方法:
1.) git fetch -> sync your local with the remote repo
2.) git branch -a -> show all branches: remote and local
3.) git checkout master -> checkout the remote master branch to your local repo
4.) git checkout [yourlocalrepo] -> (econnectConfig?) switch to you local branch again
5.) git rebase master -> update [yourlocalrepo] to master branch and apply the changes of [yourlocalrepo] on top of them
6.) git checkout master -> back to your local master branch
7.) git rebase [yourlocalrepo] -> apply the changes from [yourlocalrepo] to the master branch
8.) git push -> push your local changes to the master branch on the remote server
如果您不需要将更改推送到master,您可以通过发出命令将本地分支推送到远程分支
git push -u origin feature_branch_name
如果您不确定存储库配置是什么(查看远程连接等)
错误输出是什么?感谢您的回复,非常有帮助!我发现我所做的不起作用的原因是因为我的回购协议太不同步,前后不同步,它不知道它在做什么。在你的帮助下,我创建了一个新的回购协议,现在它开始工作了。非常感谢,不客气!我总是向我的同事推荐,或者从
git config -l --local (skip the local if you want system wide settings shown)