Differences between revisions 6 and 7
Revision 6 as of 2019-03-06 00:03:26
Size: 1724
Editor: scot
Comment:
Revision 7 as of 2019-03-06 00:05:18
Size: 1754
Editor: scot
Comment:
Deletions are marked like this. Additions are marked like this.
Line 63: Line 63:
The --rebase option tells Git to move all of your commits to the tip of the master branch after synchronizing it with the changes from the central repository. If you have changes, go edit the file to remove the conflicts (Visual Studio Code works great for this, better than Visual Studio 2017).
Line 65: Line 65:
You may then get a '''CONFLICT (content): Merge conflict in <some-file>''' which you will need to resolve by type {{{git status}}} You may then get a '''CONFLICT (content): Merge conflict in <some-file>''' which you will need to resolve by type {{{git status}}} Actually you should do that before you do anything.

Starting a git repository?

First setup the remote repository:

ssh git@brain2.scotnpatti.com
cd /home/git/repos               # you shouldn't use the base user directory for good reasons -- See SshGen page
mkdir my_project.git
cd my_project.git
git init --bare
git update-server-info # If planning to serve via HTTP
exit

On your local machine:

cd [your project directory]
git init
git add * # or "." if you want to add all the files in the hierarchy
git commit -m "My initial commit message"
git remote add origin git@example.com:repos/my_project.git
git push -u origin master

Others can now clone track the remote repository:

git clone git@example.com:repos/my_project.git
cd my_project

Adapted from: http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/

Standard workflow

edit/stage/commit

git status # View the state of the repo
git add <some-file> # stage a file
git commit # commits changes 

Publish

git push origin master

You may get an error...

Updates were rejected because the tip of your current branch is behind its remote counterpart. Merge the remote changes (e.g. 'git pull') before pushing again.

So you may need to pull by doing the following:

git fetch origin master 
git merge origin master
git pull origin master

If you have changes, go edit the file to remove the conflicts (Visual Studio Code works great for this, better than Visual Studio 2017).

You may then get a CONFLICT (content): Merge conflict in <some-file> which you will need to resolve by type git status Actually you should do that before you do anything.

ProjectManagementTools/StartingGitRepository (last edited 2023-06-06 19:32:34 by scot)