Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. Tab to autocomplete a command or directory which saves much time.
  2. ls -la to list all files in a directory
  3.  
  4. Git
  5. git init to initialize a git directory in a directory of existing code, to remove just remove the .git directory
  6. git status to see status
  7. touch .gitignore to make a gitignore directory, code .gitignore to open this and then add the files to ignore
  8. git add -A to add all files in the directory to the staging area
  9. git reset arg1 to remove arg1 from the staging area, git reset without an argument resets all
  10. git commit -m “This is where you describe the commit” to commit
  11. git pull <name> <branch> updates your repository if others have pushed commits
  12. git push <name> <branch> pushes your commits to the remote repository; git push origin master
  13.  
  14. In Git, origin is a placeholder name for the URL of the remote repository. Git sets up the origin by default when it clones a remote repository. You can use origin to access the remote repository without having to enter a full URL every time. This also means that you can have multiple remotes for a repository by giving each a unique name.
  15.  
  16. git log to see a log of commits that were made, who made them, etc
  17. git clone <url> <where to clone> to clone a remote repository
  18. git diff shows changes made to code
  19. git branch <name> to create a branch of code to work within
  20. git branch -a to see all the branches
  21. git checkout <name> to begin working in <name> branch
  22. git push -u <name> <branch> to “associate the local branch with the remote repository branch” so that you can use just git pull and git push in the future
  23.  
  24. to merge a branch:
  25. git checkout master
  26. git pull <repositoryName> master
  27. git branch --merged
  28. git merge <branchName>
  29. git push <repositoryName> master
  30.  
  31. to delete a branch:
  32. git branch –merged
  33. git branch -d <branchName>
  34. git branch -a
  35. git push <repositoryName> --delete <branchName>
  36.  
  37.  
  38. BasicTerminalCommands
  39. ~ represents the home directory
  40. ls lists files in the current directory
  41. ls -a shows hidden files
  42. ls -l shows more information
  43. ls -h shows more filesize in prefixed terms
  44. ls -s sorts by filesize
  45. ls -t to sort by time modified
  46.  
  47. ln to make a hard link to a file ex: ln a.txt b.txt
  48.  
  49. ln -s to make a symbolic link to a file or directory (more common than using a hard link)
  50.  
  51. pwd to show current directory
  52. cd ~/music (example) to go to a different directory
  53. cd by itself goes to home directory
  54. cd .. goes up to the parent directory
  55.  
  56. mkdir to make a directory
  57. mkdir -p to make nested directory
  58. mkdir -v for a verbose mode (useful to keep track of what you’re doing)
  59.  
  60. cp arg1 arg2 copies the file (arg1) to the location (arg2)
  61.  
  62. you can copy multiple files using cp arg1 arg2 arg3… argFinal where argFinal is a directory the files are being copied to.
  63. cp supports -v
  64.  
  65. cp -R to copy the contents of a directory into another directory.
  66. cp -i to ask for confirmation if a file is going to be overwritten
  67. cp -f to force overwrite if ‘permission denied’
  68.  
  69. rm is to remove a file or folder, supporting the same flags/arguments as the cp commands
  70.  
  71. mv to move files, supporting the same flags/arguments as the cp/rm commands
  72. mv can also be used to rename a file
  73. (mv essentially combines cp and rm)
  74.  
  75. | is the ‘pipe’ command and can be used to chain multiple commands together
  76.  
  77. > write the results of a command into a file
  78. < read from a file
  79. . to refer to all files in a directory
  80.  
  81. code . In a project directory to open all of the project files.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement