
================
Discussion Notes
================

1. Create an SSH key
	ssh-keygen

2. Copy the SSH key
	Linux
		xclip -sel clip < ~/.ssh/id_rsa.pub

	Mac
		pbcopy < ~/.ssh/id_rsa.pub

	Windows
		cat ~/.ssh/id_rsa.pub | clip

3. Configure the git account in the device/project
	Configure the global user email
		git config --global user.email "[git account email address]"

		example:
			git config --global user.email "john.doe@mail.com"

	Configure the global user name
		git config --global user.name "[git account username]"

		example:
			git config --global user.name "johndoe"

	Configure project email
		git config user.email "[git account email address]"

		example:
			git config user.email "john.doe@mail.com"

	Configure project username
		git config user.name "[git account username]"

		example:
			git config user.name "johndoe"

4. Check the git user credentials
	git config --global --list

5. Initialize a local git repository
	git init

6. Peek at the states of the files/folders
	git status

7. Stage the files in preparation for creating a commit
	Staging files individually
		git add [filename]

		example:
			git add discussion.txt

	Staging all files
		git add .
		git add -A

8. Create a commit
	git commit -m "[message]"

	example:
		git commit -m "initial commit"

9. Check the commit history
	git log
	git log --oneline

10. Connect to a remote repository
	git remote add [remote-name] [git-repository-link]

	git remote add origin git@gitlab.com:johndoe/s02.git
	git remote add origin git@github.com:johndoe/s02.git

11. Check the remote names and their corresponding urls
	git remote -v

12. Get the url of a remote repository
	git remote get-url [remote-name]

	example:
		git remote get-url origin

13. Change the url of a remote name

	git remote set-url [remote-name] [git-repository-link]

14. Remove a remote repository
	git remote remove [remote-name]

	example:
		git remote remove secondary

15. Upload the local repository to a remote repository
	git push [remote-name] [branch-name]

		example:
			git push origin master

16. Clone the repository
	git clone [git-repository-link]

		example:
			GitLab
				git clone git@gitlab.com:johndoe/git-clone-sample.git
			GitHub
				git clone git@github.com:johndoe/git-clone-sample.git

17. Pull the changes from a remote repository
	git pull [remote-name] [branch-name]

			example:
				git pull origin master