


WORKING TREE:
Working tree is the current version of your project. This working tree will contain all the files that are currently track by Gate.
STAGING AREA (INDEX) :
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
COMMIT :
Git record a new snapshot of the state of your project at that moment when it is committed. it's a picture of exactly how all this files looked at a current moment in time.
BRANCH:
A branch at basic level is just appointed were particular connect. It represent an independent line of development in a project. We basically create new repository Which are basically branches and we can to those branches without distracting the main branch. Branches make it really easy to experiment with new ideas or strategies and projects. When you want to add a feature of fixed something you can create a new branch and do your development there. You can merge back it into the master branch when you have got something you like or discard your changes without negative impact if they don't workout.
MERGING :
That term that git uses for combining branched data and history together.
There are two type of merges:
1. FAST-FORWARD MERGE :
It occurs when all the commits in the checked out branch are also in the branch to be merged in which case the pointers are simply updated. As longest there are no conflicts git will move the current branch tip up to the target branch tip and combines history of both commits.
2. THREE WAY MERGE:
It occurs when the two commit have diverged previously and a new commit is created.
IMPLICIT MERGE :
In implicit merge there is no separate merge commit. Only the commits from the branch are taken and placed at the top of the target branch. It can be triggered by rebase events and fast forward merges.
EXPLICIT MERGE :
Explicit merges are the default merge type. The explicit part is that they create a new merge commit. This alters the commit history and explicitly shows where a merge was executed. The merge commit content is also explicit in the fact that it shows which commit were the parent of the merge commit.
HHTP :
it is generally used to allow read only access to a repository in other words it let's people clown the content of your report without lating them push new content to it.
HTTPS & SSH :
This both provide method of authenticating uses so you can control who gets permission to push.
FORKING :
A way of creating a copy of the given repository so that it belongs to our user.
PULL REQUEST :
Commit or series of commits that you sent to the owner of the repository so that they incorporate it into their tree.
CONTINOUS INTEGRATION SYSTEM (CI) :
It will build and test our code every time there is a change.
CONTINOUS DELIVERY :
It means new code is often deployed with the goal of avoiding rollouts with lots of changes between two version.
ARTIFACT :
It can include compile code test results log any type of files generated as part of the pipeline.
----------------_---------------------_----------------------_---------
1. mkdir dir_name : it makes a directory
2. git init : it creates empty git repository in current directory
3. cd dest: it is used to go to the destination
4. touch filename.txt :it crates a empty file if It does not exist
5. rm filename.txt :it deletes the file
6. cat filename : it reads the file and displays file in command prompt
7. cat > filename.ext:it is used to write to the file. Press enter then cltr + c to save the changes
8. diff old_file new_file :diff is used to finddifferences between two files.
9. diff -u old_file new_file:it is used to compare two files, line by line, and have the differing lines compared side-by-side in the same output
10. diff - u old_file new_file>change.diff :it is used to put difference between two file into the change.diff file
11. patch new_file < change.diff :it apply the change file differences into new file.
12. ls - la :it is used to check which directory are present in current directory
13. ls -l filename/ : it is used to see what is present in that file.
14. git add file location :it is used to track the changes made by the file
15. git status :it is used to show the status of git repository. It displays the state of local directory and the staging area.
16. git commit :it is used to commit the changes made in the file.
17. git commit - m"enter the msg" : it is used to directly enter the msg without opening the editor
18. chmod +x filename : it is used to provide permission for executing the file.
19. git log ( - num) :it is used to lists the commits made in that repository in reverse
chronological order; that is, the most recent commits show up first.
20. git log - p ( - num) : it is used to see the actual changes introduced by each commit
21. git commit -a -m "msg" : it is used to commit changes without putting it in staging area if you are sure that this is changes you need.
22. git show commit-id: it is used to see information about commit and associated patch.
23. git log --stat :it is used to see which files were changed and how many lines were added or removed.
24. git diff : it is used to see changes made to files which are not staged.
25. git diff --staged : it it is used to see changes made to files which are staged but not committed.
26. git add -p : git shows the changes being added and asks whether or not to stage it or not.
[y, n, q, a, d, e,?] - >
1. y - > stage this hunk
2. n - > do not stage this hunk
3. q - > quit
4. a - > stage this and all the remaining hunks in the file
5. d - > do not stage this hunk nor any of the remaining hunks in the file
6. e - > manually edit the current hunk
7.? - > print help
27. git rm file_name : it is used to remove unnecessary files and the change is automatically staged to be committed .
28. git mv old_file new_file:it is used to rename the file, directory or symlink and the change is automatically staged to be committed.
28. git mv filename...directory:it is used to move file to only existing directory and the change is automatically staged to be committed.
29. echo *.extenstion > gitignore : git ignore file is used to tell the git tool to intentionally ignore some files in a given git repository.
30. BEFORE CHANGES ARE STAGED ->
git checkout filename.ext : it is used to revert changes to modify files before they get staged. works only in unstage area.
31. git checkout -p filename.ext : it will ask you change by change if you want to go back to the previous snapshot or not.
32. git add * : it is used to add any changes done in the working tree to the staging area.
33. file > temp_copy_file: it is used to copy file to temp_copy_file for debugging most of the times.
34. TO UNSTAGE THE STAGED CHANGES->
git reset filename.ext : it is the command we use when we want to remove the repository back to a previous commit discarding any changes made after that commit.
35. git reset HEAD filename.ext : it is used for resetting the changes on whatever in the current snapshot.
36. git reset -p filename.ext : this command can be used by Git to ask you which specific changes you want to reset.
37. rm - r directory : it is used to delete a directory and all the sub directories and the files that it contains. rm stands for remove while - r is necessary to tell dash that it needs to repeat the command through a list of all files and the sub directly within the Parent directory.
38. cp src/filename dest/: it is used to copy src file to dest file.
39. mv src/filename dest/ : it is used to copy file to the directory.
40. cat >> filename : it is used to write on new line.
41. git clone src dest : it is used to clone the stc directory to dest directory.
42. git restore *. Ext / filename.ext : it is used to restore all file of the extension.
43. git restore . : it is used to reset all files in the current directory only in unstage area
44. git configure - - global user.name " Name" :it is used to tell git who we are.
45. git configure - - global user.email
"email" :it is used to tell git who we are.
46. git config -l : it is used to check all current configuration of git.
47. git config - - global -l : it is used to check global configuration.
48. pwd(print current working directory) : it is used to print full path of the directory you are currently in.
49. modify&add changes to recent commit->
git commit - - amend : git will take whatever is currently in a Staging area and run the git commit work flow to overwrite the previous commit. It can be used to add files to previous commit which belongs to the same change and it can also be used to overwrite or provide more brief description about the commit. You should avoid amending commits that have already been made public.
50. git revert HEAD : a new commit is created with reverse changes. This cancels previous changes instead of making it as though the original commit never happened.
It points to current snapshot and revert the changes in current snapshot.
51. git revert commit-id : a new commit is created with reverse changes. This cancels previous changes instead of making it as though the original commit never happened.
Provide just the first few characters (4-8) identifying the commit to the command and the GIT will be smart enough to guess which commit ID starts with those character as long as there is only one matching possibility
52. git branch : it will list the branches present.
53. git branch new_branch_name : it will create new branch.
54. git checkout branch_name : it is used to used to switch to the new branch.
55. git checkout - b new_branch_name : it will create a new branch and switch to that branch.
56. git branch - d/-D branch_name :
- d ->it is used to delete the branch.
-D ->it is used to forcefully delete the branch
57. git merge branch_name : it will add all data and commit to the current branch.
58. git merge - - abort : if there are merge conflicts then it can be used to abort the merge action.
59. git log - - graph - - oneline : graph represent commit history in graph form. oneline represent commit history in one line only.
60. git switch branch_name : it is used to switch that branch.
61. start filename : it will open the text editor for that file
62. git clone repo_url : it creates the copy of remote repo into the local computer.
63. git push : it gathers all the snapshots we have taken and sends them to the remote repository.
64. git config - - global credential.helper cache : it uses credential.helper which caches our credentials for the time window so that we don't need to enter a password with every interaction.
65. git pull : it is used to retrieve new changes from the remote repository and automatically merges the changes the remote repo to local repo .
66. git remote - v : it is used to see the what is access provided.
67. git remote show <name> : it is used to get more information about <name> remote repository.
68. git branch - r : it is used to list the remote branches that our git repository is currently tracking.
69. git fetch : it copies the committee of remote repositories to the remote branches. it is used to retrieve remote repo commits and copy it to remote branches. it doesn't automatically update/merge the changes.
70. git remote : it lists the remote repost.
71. git remote update : it fetches the most up to date objects. It will Fetch the content of all remote branches and allow us to merge the content ourselves.
72. git checkout remote_ranch : it is used when we create new remote branch and that remote branch is not present in local branch.
By using this command git automatically copies the content of remote branch to local branch.
73. git log - - graph - - online - - all: graph represent commit history in graph form. oneline represent commit history in one line only. This graph shows as the different commits and position in the tree.
74. git log - p origin/master : it will show all commits of remote repo.
75. git push - u origin branch_name : - u is added to create upstream branch which is another way of referring to remote repository. We will also have to say that we want to push this to origin Repo and that we are pushing the branch_name.
76. git push - - delete origin branch_name : it is used to delete the remote branch.
77. git rebase branch_name : it is used to change base of the current branch to be branch name. It is when you want to keep your commit history clear.
78. clear : it clears the screen code.
79. git add name & & git commit - m "" : it will stage the file and commit the file in one line.
80. git push - f : it is used when trying to push local repo into remote repo and git tells to merge the changes and we don't want to marge changes push it as it is then - f is used with push.
81. git rebase - i master : it is used when we want to create single commit that contains the the previous changes and details description commttied. It open the text editor which contains list of all selected commits from oldest to the newest commits. By changing the first word of each line we can select what we want to do with the commit. The default action here is to pick which takes the commits and rebase them against the branch we selected. We have two option for combining commits, squash and fix up. In both cases the content of selected commits are merged into the previous commit in the list. The only difference is what happens with the commit messages. when we choose squash the commit messages are added together and an editor opens up to let us make necessary changes. when we choose fix up the commit messages for that commit is discarded.