Jump to content
Encoded

Git Tutorial

Recommended Posts

hIUWbqc.png

What is Git?
"Git is a version control system (VCS) for software development. It is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows." - Wikipedia
In simpler terms, git allows you to revert changes in your project if needed and allows you to easily collaborate with others. 
How do I get Git?
You can follow the download instructions for your OS here: http://git-scm.com/downloads
 
After installing git, you will want to set your name and email.

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Creating a Repository
We are assuming you have already set up a project via an IDE.
cd to the main directory of your project and git init to create the repository.

cd IdeaProjects/TRiBot/src
git init

Adding and Committing files to the Repository
Think of commits as different versions of your project. You can switch between commits as needed. You can add entire directories as well as individual files.

git add scripts/ExampleScript.java
git commit -m 'Descriptive commit message'

Status
We can use the git status command to display the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git. Status output does not show you any information regarding the committed project history. For history you use git log.

git status

Viewing Commit History
We use the git log command to view commit history. There are many parameters that can be added to the log command to further refine the returned commit history.

git log

Reverting to a Previous Commit
To revert to a previous commit we use the git checkout command.

git checkout <commit>

If we only want to revert a specific file, we can do so.

git checkout <commit> <file>

You now should know enough about git to be able to easily revert any undesirable changes to your scripts and increase development speed and efficiency.
 


Uploading and Pushing to a Remote Repository

We will assume you already have a git repository setup. Now you just need to add the url to remote repository and push to it.

cd /path/to/my/repo
git remote add origin https://[email protected]/Encoded/example.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push origin --tags # pushes up any tags

Now when you make commits, you can push them to the remote repository.

git push origin master

Origin is the remote name and master is the branch name.


Using branches, collaborating with others, and IDE integration coming at a later time.

Edited by Encoded
  • Like 3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Our picks

    • Please welcome our new developers, @JoeDezzy1, @erickho123, @Encoded, and @wastedbro.

      These members will be responsible for working on, maintaining, and improving TRiBot.

      This means that bug fixes and improvements will now come at a much faster pace! We're committed to providing users with the best botting experience possible!
        • Thanks
        • Like
      • 30 replies
    • This release includes:

      More 3rd party libraries for script writers to use


      Apache Commons Codec


      Apache Commons Collections


      Apache Commons Configuration


      Apache Commons IO


      Apache Commons Lang


      Apache Commons Math


      GSON


      Guava


      JFoenix




      Hint arrow API


      Game#getHintArrowX


      Game#getHintArrowY




      Fix player hooks including Player#getSkullIcon and Prayer#getPrayerIcon
        • Thanks
        • Like
      • 41 replies
    • This update includes:

      Fix broken hooks


      Fix login bot for the message "No reply from login server. Please wait 1 minute and try again."


      Fix bug relating to which bot tab is sent human input


      General#randomLong bug fix involving negative numbers


      Fix GE API



      Please note: There are still some issues with the login bot due to a change in the game mechanisms handling the login screen. We're working on a fix and will upload it when ready.
        • Thanks
        • Like
      • 37 replies
    • This release will:

      Fix key event handling issue


      Fix other event handling issue


      Fix RSServer hook


      Update world hopper to have it use OCR, thanks to Todd


      Use proper disposal of old Graphics objects


      Reformat code


      Rearrange code


      Organize code imports


      Apply around 8000 automated code refactorings


      Make preparations for Java 9


      Fix 11 various bugs


      Add more reliable debugging support


      Fix mouseEntered/Exited event dispatching bug


      Fix minimap walking bug where it opens the map


      Fix broken hooks for today's game update
        • Thanks
        • Like
      • 100 replies
    • This update will:

      Fix GE inventory item positioning bug


      Fix broken object hooks
        • Like
      • 27 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×