Pulling down latest code from github to Android Studio
Asked Answered
E

3

19

How to sync my local Android Studio project with the latest code on github?
I want to download all the latest changes but I don't want my local changes overwritten.
If there is a conflict, it should ask me to resolve those particular files.
Is there a way to achieve this?

Effectuate answered 10/6, 2015 at 20:28 Comment(0)
T
20

"I want to download all the latest changes but I don't want my local changes overwritten"

You probably want to 'fetch' the upstream before merging your changes then.

VCS -> Git -> Fetch, this will update all your branches, so you can check them and later use VCS -> Git -> Merge Changes to update your local code.

That's what fits your needs the best, I think. Normally, I would just pull the changes and resolve the conflicts.

Tetraspore answered 10/6, 2015 at 20:48 Comment(2)
Is there a place/view where i can see the list of files with conflicts that I have to resolve. The thing is if there is conflict it doesn't even update the remaining files.Effectuate
After fetching, how can I check the changes on remote?Calypso
L
2

First, you can import your project on the main menu using the check out project form Version Control. Then you can use the VCS->Update Project to download all the changes. This will leave your local changes and show you conflicts.

Legality answered 10/6, 2015 at 20:44 Comment(2)
Where does it show the conflicts? Do I have to open a view/window?Effectuate
No. There will be a pop up for conflicts.Legality
W
1

As of Feb 2024 the easiest way is to simply Git -> Update Project... (I think ctrlT or T is the default shortcut). The following window will pop up:

enter image description here

Merging is the most common choice. If git can merge automatically, it won't even say anything. If it does, you'll have the ability to fix the merge conflicts (and then make another commit as normal for this situation).

Wallack answered 6/2 at 4:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.