Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git --version (to check the version of git installed)
- GIT WORKFLOW LIFE CYCLE:
- - Working Directory;
- - Staging Area;
- - Repository (.git folder)
- - Remote.
- Git requires two bits of information before we can do anything:
- -username
- git config --global user.name
- -email
- git config --global user.email
- The process of getting a copy of a repository on GitHub onto the local system is called CLONING a repository.
- Cloning is done with the command: git clone "url"
- The "git clone" command automatically sets up a relationship back to the repository on GitHub and named that reference "origin".
- We can ask git about the state of the repository with the command: git status.
- The "working directory" is where we do all the work and that Git monitors for changes.
- An "untracked file" is a file in our working directory that hasn't been added to Git yet.
- We add files to Git with the command: git add "nameOfTheFile"
- We remove files from Git with the command: git reset "nameOfTheFile"
- Files in the staging area are files that are waiting to be committed.
- We can commit files with the command: git commit.
- When committing, we usually use -m "Some message" to add a message to the commit.
- After committing, the file is moved from the staging area to the local repository.
- For deleting a local repository: rm -rf "name of the repository"
- For stopping Git from managing our folder we can type: rm -rf .git , in the project's folder.
- We can update the files to the remote directory with the command: git push origin master
- =================
- Creating a new repository locally
- =================
- git init "name of the project"
- =================
- Adding an existing project to Git
- =================
- To add an existing project to git, we enter in the project's folder and type the command: git init
- This will add the current folder to git.
- After this, we use the "git add ." command to add all the files to Git, and after that, we use the "git commit" command to commit all the changes to Git.
- After this, we follow the commands below.
- =================
- Adding an existing project to GitHub
- =================
- git remote add origin "remote repository URL"
- git push origin master
Add Comment
Please, Sign In to add comment