HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

If someone wrote a clear and concise steps Github what to do and how to use it would beGreat

peregrineperegrine MVP
edited May 2014 in Feedback

Since the documentation is voluminous.

  • A recommended way to set it up on local machine and how to do it remotely and send pull requests.

  • A recommended way to maintain fork on Github itself, and issue pull requests and not mess up anything on the parent, etc.

I bet more of us would use it.

command step by step with a sample setup and pull request would go a long way. me thinks.

or at the very least point us to a few salient recommeded aspects of the documentation.

any takers? even a start would be good. for us in the gihub clueless class.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

«1

Comments

  • hgtonighthgtonight ∞ · New Moderator

    I don't think I am qualified to write this up, but I will give it a shot.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • peregrineperegrine MVP
    edited May 2014

    Amen brother hg. and hallejuah. it will be a great step for vanilla-man-git-kind :p

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited May 2014

    1.Make an account at github

    2.Download the app to work remotely

    3.Create a Local Repo where you will keep the work, call it Github repo or something.

    4.Create local repos of your work by adding copies of the folders with your work into the folder.

    5.open the Github app and select create a new local repo, then select the folder you want to sync with github.

    6.Once you add the repo find it in the list and select synchronize that will open the area where you see the files to be synced and the commits you made which are the changes you made or even new files. Fill out the necessary info.

    7.Select push to github, that will send your work to your repo.

    To fork someones work

    1.Go to their account and find the one you want then click the fork icon which will send a copy of their work to your repo.

    2.To send this to your computer click clone to computer or select that from your github app on your computer.

    When you create a repo there is a hidden folder inserted called .git which are the files that keep track of your changes and contain the meta data to synchronize your work back and forth.

    It is easy to make a mistake and delete the .git folder if you delete or overwrite the folder with your work that is inside of the repo you created in your computer.

    If you delete, the folder will no longer be connected to github and you will need to clone it back into your computer and then update the files not the entire folder.

    Avoid uploading addons and themes that are from your repo and contain the hidden folder .git

    It is a bit tricky but after a few times you will get the hang of it.

  • peregrineperegrine MVP
    edited May 2014

    A good start but room for alot of improvements. with examples. command lines, incorporation into editors like gedit or geany and netbeans, etc.

    actual command lines in steps e.g.
    there are good ways and bad ways of doing this I suppose - of cloning to localhost, etc.
    suggested gui github app to use

    command line instructions might be better since gui apps may not be cross platform

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Also , to update your work copy the files into the github repo folder do not send the whole folder because it will overwrite the .git hidden folder and create an unsynchronized repo double.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @peregrine said:
    A good start but room for alot of improvements. with examples.

    command line instructions might be better since gui apps may not be cross platform

    Have not used command line enough to give advice on how.... :(

  • hgtonighthgtonight ∞ · New Moderator

    How do I get started with git and GitHub?

    You will need two things: git and a GitHub account. Both are free!

    Go to https://github.com/join an sign up. Be sure to select the free plan.

    If you are completely new to git, I highly suggest running the GitHub clients as a way to get your feet wet. You can get the Windows version here: https://windows.github.com/
    You can get the Mac version here: https://mac.github.com/

    If you are running Linux, you can get the latest version here: http://git-scm.com/download/linux
    After you installed git, configure it per this guide: https://help.github.com/articles/set-up-git#set-up-git

    Congratulations, you now have git running on your local computer!

    Now what?

    Assuming you are doing this to work on Vanilla Forums, the next thing you want to do is fork Vanilla Forums, Inc.'s repository on GitHub. You can find the core Vanilla repository here: https://github.com/vanilla/vanilla

    If you are signed in to GitHub, you can fork the repository by clicking on the forking icon in the upper right hand corner of the page.

    Wait, what is a fork?

    A fork is a clone of a repository you don't have write access to. It contains everything in the original repo and its history.

    You can do anything you want with this version. You own it. Doesn't open source rock?

    Once you have successfully forked the Vanilla repository, you probably want to clone that repo to your local machine. You can do this by either clicking on the Clone in Desktop button on your forked repo at GitHub, or by opening your terminal and using the following commands:

    mkdir ~/projects
    cd ~/projects
    git clone https://github.com/hgtonight/vanilla.git
    

    This will create a folder in your home folder called projects and clone my forked vanilla repository into the folder called vanilla. Be sure to replace my username (hgtonight) with your GitHub username.

    Once that is done, we have a full copy of the repo hosted on GitHub on our local computer. If we direct our localhost to serve the ~/projects/vanilla folder, we can make changes to the source and see what happens in our browser.

    We need to switch to the proper branch if we want to work on the open source version. The current stable version of Vanilla is 2.1, so we need to checkout the 2.1 branch:

    git checkout 2.1
    

    We can start hacking at this point, but we want to keep our fork up to date. We can do this by adding the original repo (vanilla/vanilla) as a remote source to our forked repo and periodically pull in the changes. This is done the following way:

    git remote add upstream git://github.com/vanilla/vanilla.git
    

    Once this is done, we now have two remote repositories that can be used to update the local repo. You can retrieve a remote repo using the fetch command. Let's do that right now.

    git fetch upstream
    

    This will check the upstream for any changes since the last fetch and transfer them to your local machine. If there are some changes in Vanilla's 2.1 branch, we can pull them into our local repo with:

    git checkout 2.1
    git fetch upstream
    git merge upstream/2.1
    

    This will merge in the remote source upstream's 2.1 branch into our local 2.1 branch. That is a lot of typing and you can use the pull command to turn that into one command.

    git pull upstream/2.1
    

    It is a good idea to periodically pull in upstream's commits so you stay up to date. Knowing this, you should now have a fork of Vanilla that you can update using git.

    OK, but what if I want to submit some changes?

    As an exercise, we are going to make a nonsense change and submit it as a pull request. We are going to change the default pagination size.

    First, since Vanilla Forums, Inc. uses the gitflow workflow, we need to create a branch for our patch.

    git checkout 2.1
    git checkout -b patch/default-pagination-update
    

    This will create a branch called patch/default-pagination-update based on the 2.1 branch and checkout the contents into our working tree.

    Open up ~/projects/vanilla/applications/vanilla/settings/configuration.php with your favorite PHP editor. Locate the line that looks like $Configuration['Vanilla']['Comments']['PerPage'] = '30'; and change the number 30 to 25. Save that file.

    Now that we made a change, we need to commit that code to our git repo. You can see the status of your working tree versus the last commit by using git status. It should list the file we modified as not staged for commit. Let's stage that file and then commit it.

    git add applications/vanilla/settings/configuration.php
    git commit -m 'Default to 25 comments per page'
    

    You can add all currently modified files and commit in one step using the -a switch:

    git commit -a -m "Adding all modified files"
    

    Definitely a lot faster once you are editing more than one file. That said, be careful with -a!

    At this point, our local repo has our new default committed. If we want to submit this change to Vanilla Forums, Inc.'s repository, we will need to push our changes to our fork first.

    git push
    

    That seems easy enough.

    Navigate to your repository's page on GitHub (https://github.com/{your_user_name}/vanilla if you have been following along). Select your patched branch from the branch dropdown. Then click on the compare button.

    There will be a little preview with your commits below the form. If you are looking to make a PR, you will need to pick the branch you want to submit the PR to. Click edit and select the 2.1 branch on the vanilla repo. Then click on the Create Pull Request button. Fill out the form with the information of what you are trying to solve. When you are satistfied, press the Send Pull Request button.

    You just submitted your first pull request!

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited May 2014

    Nice @hgtonight ! You should change the title of this to "Got Github ? "

    then --- > tutorials <3

  • hgtonighthgtonight ∞ · New Moderator
    edited May 2014

    What is GitHub?

    GitHub is a web service that hosts git repositories (repos for short). git is a distributed version control system that is designed for collaboration. So, GitHub hosts a git repository.

    Vanilla Forums, Inc. uses GitHub to host the source code for Vanilla.

    They want you to submit issues and patches through GitHub.

    What is a Version Control System?

    A version control system, or VCS, is used to keep track of code changes. Most VCSs provide committing, branches, and merging. I explain each feature briefly below.

    As you code up features in your software, you periodically save your progress in the VCS. In git, this is called committing code. A major benefit of committing code is being able to roll back changes if you mess something up.

    As you start releasing software, you may want to manage multiple versions of code simultaneously. In git, these different versions are called branches. Any commits you make to one branch are not automatically shared with the other branches.

    As you find bugs in your code, you probably want to fix them. Once you commit your changes to fix the bug, you probably want to also fix it in another branch. While you could create a separate patch and commit it to that branch, you can instead merge two branches together. This will take all of the commits from one branch and apply them another branch.

    Why use git?

    git is a distributed version control system. Apart from just being a version control system, it is designed to be used by multiple people simultaneously. Everyone can commit their changes independently of each other.

    GitHub hosts git repositories. Vanilla Forums, Inc. hosts their repos there. This gives anyone with a knowledge of git to have direct access to the source code. This is a huge advantage for open source projects.

    How does Vanilla Forums, Inc. use git?

    You can find a great description here: https://github.com/vanilla/vanilla#version-control-strategy

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • peregrineperegrine MVP
    edited May 2014

    super thx hgtonight. I'll give it a try.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • LincLinc Detroit Admin

    Secret: Create a new public repository on GitHub. It prompts you how to set it up and get started.

  • peregrineperegrine MVP
    edited May 2014

    .

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited May 2014

    git fetch upstream - does work
    git merge upstream/2.1 - does work

    but this still gives:

     git pull upstream/2.1    
    fatal: 'upstream/2.1' does not appear to be a git repository    
    fatal: The remote end hung up unexpectedly    
    

    any ideas - anyone?

    oh well, perhaps github is not for me.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    If it says that then you need to create it. I got that from the UI when I inadvertently did not realize I did not have that repo any longer or changed the name.

  • peregrineperegrine MVP
    edited May 2014

    I understand what you are saying. but shouldn't the instructions work? or am I understanding hg's instructions.

    and I am not sure how exactly to create it and where.

    theoretically as hg said:
        git checkout 2.1   
        git fetch upstream   
        git merge upstream/2.1   
    
    
    is the same as
    
    git pull upstream/2.1    
    

    git remote show upstream
    * remote upstream
      Fetch URL: git://github.com/vanilla/vanilla.git
      Push  URL: git://github.com/vanilla/vanilla.git
      HEAD branch: master
      Remote branches:
        2.0                             tracked
        2.1                             tracked
        develop                         tracked
        feature/autodetectcdns          tracked
        feature/autogrow-js-modern      tracked
        feature/cachesharding           tracked
        feature/contributing            tracked
        feature/docs                    tracked
        feature/invitation-improvements tracked
        feature/logging                 tracked
        feature/markdown                tracked
        feature/promotedtypes           tracked
        feature/reconnect               tracked
        feature/security                tracked
        feature/tagging-allow-jit-tags  tracked
        feature/viewsfix                tracked
        hotfix/mysqlstrict              tracked
        hotfix/profileunread            tracked
        hotfix/thebump                  tracked
        hotfix/twitter-embed            tracked
        livequery-deprecation           tracked
        master                          tracked
        recaptcha-localization          tracked
        stage                           tracked
      Local refs configured for 'git push':
        2.1    pushes to 2.1    (up to date)
        master pushes to master (up to date)
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Because the UI is what helps you do the middle man stuff.

    Using the UI , you can create repos on your computer and also at github

    I guess you need the proper rules to add to the console to create a repo if there is not one.

    The UI asks where you want to create it if Local or Github. This is why I like working with the UI and not the console. But it is due to lack of know how.

  • chanhchanh OngETC.com - CMS Researcher ✭✭
  • peregrineperegrine MVP
    edited May 2014

    well hgtonight. despite not being able to use git pull upstream/2.1 as a shortcut for fetch and merge.

    Everything else worked as expected from your instructions.

    was able to push my request to github. tried to unsuccessfully remove (delete) push, and decided to remove repository till learn more about undoing things.

    Thanks a lot for the tutorial.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    There should be a github badge , here is the github pussy

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited May 2014


    Here is the badge in case someone think it is a great idea to get people to get their git on @Linc :D

Sign In or Register to comment.