• Hi there,

    I am just starting to learn all the power behind GIT to keep track of versions, and from that, comes a lot of questions.

    I know how to use the wpcli, and I am not afraid with terminal commands.

    I’d like to have advices, to learn about best practices when managing the code from github or gitlab.

    First thing first :

    How would you create the repository?

    Would you clone? or mirror from https://github.com/WordPress/WordPress.git ?

    Would you create a blank repository and install wordpress from wp cli?

    Do you think it’s a good idea to be aware / keep track of every single commit from the wp dev team on wordpress? Or just the commits from our own install is enough?

    I am looking forward to hearing your recommendations about that to make the best start as possible.

    Thanks!

    • This topic was modified 2 years, 11 months ago by tskpbls.
    • This topic was modified 2 years, 11 months ago by tskpbls.
    • This topic was modified 2 years, 11 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Why would you want to include WP core in your repository? It should contain your work, not the work of others. I develop on a local WP installation. When my theme/plugin is ready for distribution, then that version gets committed to the repository.

    Disclaimer: I have the subversion repository for WP plugins and themes in mind, not specifically github, but I think the same concepts should apply.

    For example, look at the Gutenberg project on GitHub. This is a development version. The public release ends up getting committed to the WordPress subversion repository, but that’s beside the point. The point is there is no WordPress core present here.

    I suck at GIT so I am not the right person to answer your question but since nobody else responded I will give it a try.

    Not sure what you want to use git for, since you talk about the WP repository. Do you want to make contributions to the wp core? No idea how that works, maybe others can chime in.

    I use git to version-control the work I do when I work on themes. In that case, my repo is just the (child) theme, not the whole WP install. I do not use the cli but a visual app, which gives you a good overview and control over the changes that have been made. You get an overview of your commit messages, can look at files and see what was changed. You see your file status, uncommited changes, history. There is a search function. If you work with branches this is much easier to see what is going on. All commands that git uses are available. You can also open the terminal from within the app which will put you right in the correct directory.

    It is easy to connect SourceTree to bitbucket or Github and create remote repo’s and push, pull and fetch from there.

    cli may or may not be the cool kids choice, but this is so much more convenient. I use SourceTree, which is free. Git Tower is almost exactly the same, but paid. I highly recommend using a GUI to git.

    How would you create the repository?
    Does not really matter, I do not clone but make an empty repo and put my stuff in it. Or from SourceTree, I add it as a Sourctree project (a repo) with “add existing local repository” which points to the theme folder in my local dev site.

    Hope this helps a bit. Some concepts in git can get very complicated but the basic usage is not complicated. Also, I work alone so I mainly work on the main branch, no need for pull requests or whatever. Must say that I could not imagine working without it. Git has saved my a$$ and hours of work on multiple occasions. If you work with code, version control is a necessity.

    • This reply was modified 2 years, 11 months ago by eagerbob. Reason: typo's
    • This reply was modified 2 years, 11 months ago by James Huff.
    Thread Starter tskpbls

    (@tskpbls)

    Hi @eagerbob, @bcworkz

    Thanks a lot for your answers.

    Please consider that I am making my very first steps with git. I do not consider myself as a developer, although I think I have a good knowledge on everything wordpress…

    @bcworkz

    Why would you want to include WP core in your repository?

    Because I have no method nor strategy yet on how to use git. I understand what it does and why it is useful but I’d like to make the most of it without making it unmanageable.

    @eagerbob says

    I use git to version-control the work I do when I work on themes. In that case, my repo is just the (child) theme, not the whole WP install.

    and that’s probably enough for my use case too.

    However, I’d like to underline this point on mirroring rather than cloning.

    I understand that mirroring the public wp repository updates the code on my own repository at intervals. It differs from cloning that is just a static version of the code. Please let me know if I am mistaken here.

    This point allows me to rephrase my question :

    Let’s consider 3 environments :

      Development as a local install
      Production as a live install
      And staging to test that everythings ok before pushing to production

    I was thinking about having the upcoming (beta) version of wordpress locally to anticipate any issue with the code I have in my custom function.php (in a child theme of course)… That doesn’t mean I’d be technically skilled to solve the issues, but at least I would be able to anticipate what to push or not push to the following staging step.

    I am not saying that this is the best method. I do repeat that I have no methods yet, I only have questions, to ask for your best advices.

    My original question was :

    Do you think it’s a good idea to be aware / keep track of every single commit from the wp dev team on wordpress? Or just the commits from our own install is enough?

    It looks like you guys only push the files you authored personnally to keep track of your own modifications… (That’s the point with git you’d reply!)

    What version of wordpress do you use locally? The last stable version? the upcoming beta version?

    Moderator bcworkz

    (@bcworkz)

    You’re correct about the concepts of mirroring vs. cloning. I’ve never had a need to do either with WP core in a repository. It’s the same package regardless of where it’s hosted. We simply “plug in” to it. Development environment and repository are two entirely different things. Development is where I work on code. The repository is where I keep and release my work once it’s all working correctly, keeping older versions of earlier releases as well.

    I generally use the latest stable WP version for development, but I’ll test release candidates against my work whenever they become available. I don’t concern myself with beta or anything earlier than release candidates.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Advices with GIT and WP : Mirror? blank project + wp CLI?’ is closed to new replies.