Skip to content

Instantly share code, notes, and snippets.

@ccannon94
Last active October 16, 2024 19:19
Show Gist options
  • Save ccannon94/982d69b23659d66c0ca6fb1384f94c97 to your computer and use it in GitHub Desktop.
Save ccannon94/982d69b23659d66c0ca6fb1384f94c97 to your computer and use it in GitHub Desktop.
Using Git from the Command Line

When you use git from the command line, use the following steps:

Accessing the Repository

  • On Windows, launch Git Bash, on MacOS or Linux, launch a terminal.
  • If you have not done so on your machine, create a COMP167 directory in your home directory using mkdir ~/COMP167
  • NOTE: This command only needs to be run once on each machine, to create the directory.
  • Navigate to your directory using cd ~/COMP167.
  • If your repository already exists locally, navigate to it using cd [your-repository-name], if you want to check the contents of your directory, use ls.
  • If your repository does not exist locally, get the clone link from the "Clone or Download" button on the GitHub Repository. Clone or Download Button on GitHub
    • Then, clone your repository by using git clone [your-copied-url]
  • Once your repository has cloned, you must select it by changing directories: cd [your-repository-name]

Preparing the Repository

  • Now, make sure you are on the correct branch. You can check this branch using git branch and looking at which branch is marked with an asterisk.
  • NOTE: Updating the project from master
    • If you have worked on your project on multiple machines, it is a good idea to update from master before working. To do this, checkout master using git checkout master.
    • Now, make sure your master branch is up to date using git pull.
    • Checkout your working branch using git checkout [working-branch-name]
    • Make sure this branch is up to date with its remote self using git pull
    • Now, update your branch from master using git rebase master
    • You are now up to date and ready to work!
  • To create AND checkout a new working branch, use git checkout -b [working-branch-name]
  • Now, if your working branch is shown as your active branch, you're ready to get to work!

Working in the Repository

  • Open the code in Netbeans and begin working. Once you have made a single logical change to the code, it is time to make a commit!
  • Save your work in Netbeans before switching to your terminal
  • Now, stage your changes using git add .
  • Commit your changes using git commit -m "[your-commit-message]"
    • Type a brief (55 characters or less) description of the change you made. If you cannot summarize the change in 55 characters, you probably changed to much! Remember to use the imperative voice when writing commit messages, meaning say "Make change to the code" instead of "Made changes to the code".
    • Example: git commit -m "Create toString method in Student class"
  • Now that your commit is made, you should push these changes to the remote repository using git push
  • Repeat this process until your code is complete!
@nashrahnaseem
Copy link

import java.util.;
import java.lang.
;
import java.io.*;
class nash
{ int m=0;
public static void main(String args[])
{ System.out.println("enter the number which you want to convert");int c=1;
Scanner scn=new Scanner(System.in);
double n=scn.nextDouble();
System.out.print("enter the precesion value");
int g=scn.nextInt();
System.out.println("enter the base number");
int a=scn.nextInt();
c=(int)n;
n=n-c;
nash ifa=new nash();
ifa.asiya(c,a);
System.out.print(".");
ifa.naba(n,g,a);

}
void asiya(int c,int a)
{   
    int t=1;
    if(c==0);
    //return 0;
    else
    {  
        t=c%a;
        if(t==10)
        {
            asiya(c/a,a);
            System.out.print("A");
        }
        else if (t==11)
        {
            asiya(c/a,a);
            System.out.print("B");
        }
        else if (t==12)
        {
            asiya(c/a,a);
            System.out.print("C");
        }
        else if (t==13)
        {
            asiya(c/a,a);
            System.out.print("D");

        }else if (t==14)
        {
            asiya(c/a,a);
            System.out.print("E");

        }else if (t==15)
        {
            asiya(c/a,a);
            System.out.print("F");

        }
        else 
        {
            asiya(c/a,a);
            System.out.print(t);

        }




    }
}
void naba(double p,int g,int a)
{

    if(m==g);
    //return 0;
    else
    {
      int t=(int)(p*a);
      if(t==10)
      {
          System.out.print("A");
          m++;
          naba((p*a)-t,g,a);
      }
      else if(t==11)
      {
          System.out.print("B");
          m++;
          naba((p*a)-t,g,a);
      }
      else  if(t==12)
      {
          System.out.print("C");
          m++;
          naba((p*a)-t,g,a);
      }
     else  if(t==13)
      {
          System.out.print("D");
          m++;
          naba((p*a)-t,g,a);
      }

     else   if(t==14)
      {
          System.out.print("E");
          m++;
          naba((p*a)-t,g,a);
      }
     else if(t==15)
      {
          System.out.print("F");
          m++;
          naba((p*a)-t,g,a);
      }
      else
      {
         System.out.print(t);
         m++;
         naba((p*a)-t,g,a);
      }
    }
}

}

@gkvai2491
Copy link

Username

@CrackedSans
Copy link

'Hi James using git with atom is simple as pressing a button Read the Atom Menu it should tell you it is linked with it'

@CrackedSans
Copy link

At the start up menu

@CrackedSans
Copy link

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment