probably jekyll is prepending that for you to make local dev easier - when doing jekyll serve it does that (I think to site.url?) as it assumes you are doing development . If you do jekyll build which normally you would do when deploying I don’t think it will do that.
Can I use this Jekyll build --watch in the command prompt while developing the website.
OR
Should I use at the time of deploying the website on server.
I would just use serve when doing dev work, and then use build when you go to deploy it.
Just remember that when doing serve it is swapping in local host instead of the actual site settings.
I find it much better to use a Gulp file, this gives you auto-reload so the browser refreshes whenever you save a file, even works with config file changes. It is a little more complex to get setup, but once it works it just works.
It does get a little complicated if you are using GH for hosting a project, as then you need the baseurl which can mess with your urls locally. To fix that I use a second config file that is only used on local dev to override the baseurl setting (this is basically what jekyll serve is doing as of 3.3). You can see a project with a gulp file and a second config file here:
As @rdyar stated above, running jekyll serve spins up a development server for local testing. Jekyll automatically overwrites url set in your _config.yml with localhost:4000 when doing this. Versus jekyll build which doesn’t mess with any of that.
It’s a good practice to run jekyll build when you want to prepare your files for production and deployment. You may have to use environment variables as well depending on the plugins being used.
Jekyll’s default is to set it at JEKYLL_ENV=development and can cause things like analytics and Disqus comments to be omitted. I know a few themes (like the default Minima) do things like this to only show comments when in production.
{% if page.comments != false and jekyll.environment == "production" %}
... stuff ...
{% endif %}