简体   繁体   English

Git用于版本控制Android项目

[英]Git for version controlling Android project

For some mysterious reasons, I ended up deleting my local repository. 由于某些神秘的原因,我最终删除了本地存储库。 I now cloned my remote repo back into my Eclipse workspace and it shows that I am working on the master branch of my Android project rather than the local repo and it makes sense. 现在,我将远程存储库克隆回了我的Eclipse工作区,这表明我在处理Android项目的master分支,而不是本地存储库,这很有意义。

The reason why I started using Git is so that I can make wild changes to the project and if anything breaks, I can go back to the last stable state. 我开始使用Git的原因是为了使我可以对项目进行疯狂的更改,如果发生任何问题,我可以返回到上一个稳定状态。 Now, with a local repo gone and me working straight on my master branch of the project, I do not know how that can be done. 现在,在没有本地存储库的情况下,我直接在项目的主分支上工作,所以我不知道该怎么做。

Please tell me how that can be done. 请告诉我该怎么做。

PS: I need to have Android project in my workspace or else Eclipse starts complaining cause it cannot find user libraries PS:我需要在工作区中安装Android项目,否则Eclipse开始抱怨,因为找不到用户库

If you cloned the remote repo back into your workspace, you have a local repo once more. 如果将远程存储库克隆回您的工作区,则您将再次拥有一个本地存储库。 And you can always create new branches for your wild changes instead of working directly on the master branch. 而且,您始终可以为您的野蛮更改创建新分支,而不是直接在master分支上工作。

You can make brach say masterbranch and dev barch : master brach means most stable code is in , dev brach means after any changes u willing to take backup u can push to dev brach and dont push to master until and unless ur sure of it. 您可以将brach称为masterbranch和dev barch:master brach表示最稳定的代码在其中,dev brach表示在您进行了任何更改之后,您愿意进行备份,您可以推送到dev brach,除非您确定,否则不要推送到master。

Create local brach 创建本地分支

git checkout -b your_branch

Push it to the remote server. 将其推送到远程服务器。

git push <remote-name> <branch-name>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM