└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Git-Work 2 | 3 | ## 1. Creating a New Git Repository and Pushing It to GitHub 4 | 5 | ```sh 6 | # Initialize a new Git repository locally 7 | git init 8 | 9 | # Add all files in the current directory to the Git repository 10 | git add . 11 | 12 | # Commit the files with a message 13 | git commit -m "Initial commit" 14 | 15 | # Add your GitHub repository as the remote origin 16 | git remote add origin https://github.com/your-username/your-repo-name.git 17 | 18 | # Push the commit to the master branch (or main branch) on GitHub 19 | git push -u origin master 20 | 21 | ``` 22 | 23 | ## Pushing Changes After Each Update 24 | 25 | ```sh 26 | # Add changes to the staging area 27 | git add . 28 | 29 | # Commit the changes with a message 30 | git commit -m "Your commit message describing the change" 31 | 32 | # Push the changes to the GitHub repository 33 | git push 34 | 35 | ``` 36 | 37 | ## Cloning a GitHub Repository 38 | 39 | If you want to copy a remote repository to your local machine, you use the `git clone` command. 40 | 41 | ```sh 42 | # Clone a repository from GitHub 43 | git clone https://github.com/your-username/your-repo-name.git 44 | ``` 45 | --------------------------------------------------------------------------------