[go: up one dir, main page]

0% found this document useful (0 votes)
6 views5 pages

Git Hub

github comments notes

Uploaded by

22z111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Git Hub

github comments notes

Uploaded by

22z111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

GIT

1. Set up user email in Git:

git config --global user.email "tsdakshinpriya@gmail.com"

This sets the global Git configuration to use your email address for all repositories on your
machine.

2. Set up user name in Git:

git config --global user.name "Dakshin-priya"

This sets the global Git configuration to use your name for commits on all repositories on
your machine.

3. Verify the global user email:

git config --global user.email

This command checks the email you have set globally for Git.

4. Verify the global user name:

git config --global user.name

This command checks the name you have set globally for Git.

5. Navigate to the 'leetcode' directory:

cd leetcode

Changes the directory to the leetcode folder where you are working on your project.
6. View the contents of the file gittoken:

cat ~/gittoken

This command displays the contents of the gittoken file from your home directory, which
could be your GitHub authentication token.

7. Get the absolute path of gittoken:

realpath ~/gittoken

This shows the full path of the gittoken file.

8. Create a DataStructure directory:

mkdir DataStructure

This creates a new directory called DataStructure within the current folder.

9. Navigate to the DataStructure directory:

cd DataStructure

Changes the directory to the newly created DataStructure folder.

10. Create a Tree directory:

mkdir Tree

This creates a new directory named Tree inside the DataStructure folder.

11. Navigate to the Tree directory:

cd Tree

Changes the directory to the newly created Tree folder.

12. Create a Number-of-LeafNodes directory:

mkdir Number-of-LeafNodes

This creates a directory for your project, Number-of-LeafNodes, inside the Tree folder.
13. Navigate to the Number-of-LeafNodes directory:

cd Number-of-LeafNodes

Changes the directory to the Number-of-LeafNodes folder where your code will reside.

14. Open the file method1.c in a text editor:

gedit method1.c

Opens the file method1.c in the gedit editor for editing (you can replace gedit with another
editor like nano or vim if you're using a different environment).

15. List the contents of the current directory:

ls

Shows the files and directories in the current directory to confirm that method1.c is present.

16. Remove directories or files method and method1:

rm -rf method method1

This deletes the directories or files named method and method1 recursively and forcefully.

17. Check the status of your Git repository:

git status
This command shows the current status of your repository, including any untracked,
modified, or staged files.

18. Stage the changes (add the file method1.c to Git):

git add method1.c

Stages the file method1.c for committing (it’s now tracked by Git).

19. Check the status again to confirm staging:

git status

This confirms that the file method1.c is now staged and ready for committing.

20. Commit the changes with a message:

git commit -m "added method1 for number of leafnodes"

This commits the staged changes to the local repository with a message describing the
change (adding a method for counting leaf nodes).

21. Check the status after the commit:

git status

Shows the status again, which should indicate that there are no more changes to commit.

22. Add the remote repository (named origin3):


git remote add origin3 https://github.com/Dakshin-priya/Leetcode_Problems.git

This links your local repository to a remote repository on GitHub called origin3 with the
provided URL.

23. Push the committed changes to the remote repository (origin3) on the master
branch:

git push origin3 master

This pushes your local commits to the remote repository on GitHub's master branch.

You might also like