简体   繁体   中英

How do I keep a git clone updated?

I am developing a project on my laptop that is to be implemented on my VPS. I am continually making updates on my laptop and pushing them to my git repo, but I am in the dark on how I should keep the clone I made on my server, updated.

When I try to run git clone <url> in my directory, it tells me 'file already exists!' or something along those lines. Do I just delete the entire folder and reclone the repo like that? Or is there a way, other than initiating the directory as git, and creating an upstream, that I can reclone without having to delete everything first?

try to use git pull . it will automaticly analyze the difference .And try to fix it

Instead of having to go to your server and pulling, you could setup a listener in order to do the pull for you.

For instance, if you are ushing to GitHub or BitBucket or GitLab, you can setup a webhook ( GitHub webhook , BitBucket webhook , GitLab webhook ), and a local listener in order detect the push, and triggger a git -C /path/to/your/repo pull .

How do I keep a git clone updated? I generally clone git project.

git clone git@source.golabs.io:mobile/project-name.git

and after that I start developing my feature by creating new branch branch. so for up to date with remote project you need to checkout to master branch. and just do git pull and sync your project using ./gradlew clean build

If your project have submodules- you need to do

git submodule update --init --remote --recursive 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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