Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
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

    • This release will:

      Fix LG for both OSBuddy and RuneLite


      Fix issue where the resizable client isn't able to be made smaller (Thanks @JoeDezzy1)


      Fix detection of the logout game tab when resizable mode and side panels are enabled (Thanks @JoeDezzy1)


      Add initial support for Sentry to allow us to identify and easily debug exceptions happening with all TRiBot users


      Add methods to determine if the bank is actually loaded, and not just the overarching interface (Thanks @wastedbro)



      Upcoming updates:

      Improved CLI support


      Full Sentry support


      Much more
        • Like
      • 57 replies
    • This release will:

      Fix NPE in Camera API (Thanks @wastedbro)


      Update deposit box interface ids (Thanks @Encoded)


      Add various bank methods (Thanks @wastedbro)


      Banking#getWithdrawXQuantity


      Banking#getDefaultWithdrawQuantity


      Banking#arePlaceholdersOn




      Fix resizeable minimap bug (Thanks @wastedbro)


      Remove Java 8 requirement


      Please note: TRiBot is not yet fully compatible with Java 10+




      Fix the break handler issues by ensuring the break handler thread never gets paused


      Fix broken settings hooks



      Upcoming updates:

      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 68 replies
    • This release will:

      Add support for using custom F key bindings to switch between game tabs (Thanks @erickho123)


      Fix tab opening for "Skills" and "Kourend Tasks" (Thanks @erickho123)



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 34 replies
    • This release will:

      Fix an issue where breaks would stop firing


      Fix Combat#getWildernessLevel, use dynamic search for text and cache ID for later calls


      Fix an NPE in the Combat API


      Fix Mouse#leaveGame bug where the mouse wouldn't actually leave the game screen
        • Like
      • 21 replies
    • This release will:

      Add LG support for Runelite


      Fix NPCChat issues


      Fix a bug where the camera angle setter would just hold down a key for 5 seconds (the timeout)


      Slightly adjust the rotation via keys to be more accurate


      Add the ability for asynchronous camera movement via keys


      Make Camera rotation via mouse more fluid, with more antiban, and work much better in resizable mode


      Add a "Camera#setCamera" method, allowing the rotation and angle to be set in parallel


      Increase the likelihood of using the mouse for camera movements


      Add support for adjusting the camera to positionable entities (Positionable#adjustCameraTo)



      Upcoming updates:

      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Thanks
        • Like
      • 59 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×